home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / v cisle / fma / fma-2.1-beta-4-setup.exe / {app} / CarpediWebMouse.vbs < prev    next >
Text File  |  2005-09-01  |  84KB  |  3,468 lines

  1. Option Explicit
  2. ' ------------ CarpediWebMouse.vbs version 1.4b (see below for real number) -------------
  3.  
  4. ' :: Requirements ::
  5.  
  6. '       * FMA build "0.1.0.31e" ar later
  7. '       * Microsoft Script Control engine
  8.  
  9. ' :: TODO ::
  10.  
  11. '       * Split PowerDVD 4 and 5 menu into several submenus
  12.  
  13. ' :: Credits ::
  14.  
  15. '       * Compiled by Dako - SEND ANY UPDATES TO ME (see 'Contacts' for details)
  16. '       * iTunes support by daveo
  17. '       * WinDVD5 control by skyw33
  18. '       * WinDVD4 control by rwt
  19. '       * Webcam support (T610) by HRS
  20. '       * Mouse Control by Vit Ondruch
  21. '       * Media Player, PowerDVD, PowerPoint optimizations by jbngar
  22. '       * Locate Phone by nossenigma
  23. '       * Speech Text by skyw33
  24. '       * Shutdown menu by CarpeDi3m
  25.  
  26. ' :: Contacts ::
  27.  
  28. '       * original script created by CarpeDi3m <CarpeDi3m1687 AT hotmail.com>
  29. '       * send any cool scripts to Dako <z_stoichev AT users.sourceforge.net>
  30. '         if you want to share them with all FMA users.
  31.  
  32. ' :: Supported Features ::
  33.  
  34. '       * iTunes
  35. '         - Play/Pause
  36. '         - Stop
  37. '         - Prev Track
  38. '         - Next Track
  39. '         - Vizualizer
  40. '         - Launch/Close
  41.  
  42. '    * Hauppauge WinTV
  43. '      - remote mode (enter numbers)
  44. '      - mute toggle
  45. '      - fullscreen toggle
  46. '      - prev/next channel
  47. '      - freeze image
  48. '      - make snapshot
  49. '      - launch/close WinTV
  50.  
  51. '    * MoreTV
  52. '      - remote mode (enter numbers)
  53. '      - mute toggle
  54. '      - fullscreen toggle
  55. '      - prev/next channel
  56. '      - freeze image
  57. '      - make snapshot
  58. '      - launch/close WinTV
  59.  
  60.  
  61. '    * WinAmp 2 and 5 (only with WinampComLib.dll v1.1 plugin)    [NO WINAMP 3.X SUPPORT!!!]
  62. '      - playlist ( + song info )
  63. '      - standard play functions ( play, pause, prev/next track )
  64. '      - volume (slide control)
  65. '      - seek ( slide control Still buggy!!)
  66. '      - options ( shuffle on/off, repeat on/off)
  67. '      - file launcher (*new*)
  68. '      - launch/close Winamp
  69.  
  70. '    * PowerDVD
  71. '      - standard play functions ( play, pause, stop, prev/next chapter, step backward/forward )
  72. '      - capture frame
  73. '      - audiostream toggle
  74. '      - subtitle toggle
  75. '      - volume (+/- 5)
  76. '      - mute toggle
  77. '      - fullscreen toggle
  78. '      - set repeat points
  79. '      - launch/close PowerDVD
  80.  
  81. '       * WinDVD
  82. '         - Play/Select
  83. '         - Pause
  84. '         - Stop
  85. '         - Prev Chapter
  86. '         - Next Chapter
  87. '         - Go Up/Down
  88. '         - Subtitles
  89. '         - Volume Up
  90. '         - Volume Down
  91. '         - Mute toggle
  92. '         - Full Screen
  93. '         - Speed Down
  94. '         - Speed Up
  95. '         - Fast Forward
  96. '         - Rewind
  97. '         - Launch/Close
  98.  
  99. '       * ZoomPlayer
  100. '         - Play/Pause
  101. '         - Stop
  102. '         - Prev Chapter
  103. '         - Next Chapter
  104. '         - Jump ahead
  105. '         - Jump back
  106. '         - Subtitles
  107. '         - Volume Up
  108. '         - Volume Down
  109. '         - Mute/UnMute
  110. '         - Full Screen
  111. '         - Fast Forward
  112. '         - Rewind
  113. '         - Launch/Close
  114.  
  115. '    * BSPlayer
  116. '      - standard play functions ( play, pause, stop, prev, next, )
  117. '      - fullscreen toggle
  118. '      - subtitle on/off
  119. '      - zoom
  120. '      - launch/close BSPlayer
  121.  
  122. '    * Media Player 9
  123. '      - standard play functions ( play, pause, prev/next track )
  124. '      - fullscreen toggle
  125. '      - launch/close Media Player 9
  126.  
  127. '    * Volume Control
  128. '      - mute toggle
  129. '      - master volume control
  130. '      - show current master volume level
  131.  
  132. '    * PowerPoint
  133. '      - start show
  134. '      - next slide
  135. '      - prev slide
  136. '      - end show
  137.  
  138.  
  139. '    * Custom MenuSettings
  140. '      - selection of menu items
  141. '      - sorting of menu items
  142. '      - selection of phone [t610/t68i]        (default: t610)
  143. '      - option to save settings in a config-file (default: off)
  144.  
  145.  
  146. '       * PC Mouse Control
  147. '         - move
  148. '         - left/right click
  149. '         - wheel up/down
  150.  
  151. '       * PC Volume Control
  152. '         - volume up/down
  153. '         - mute toggle
  154.  
  155. ' :: Implementation ::
  156.  
  157. '************ Change these settings as needed *************
  158. ' look also in Sub OnConnected (below) for more settings
  159. '**********************************************************
  160.  
  161. Sub setDefault
  162.   ScriptVersion        = "1.4b"    'current script version for tracking config file
  163.  
  164.   SaveSettingsBool     = FALSE        'default saving setting
  165.   SettingBackOption     = FALSE        'default back menu-item
  166.  
  167.   T610Enabled         = TRUE        'default selected phone on T610
  168.   selectPhone                'load values for selected phone
  169.  
  170.   initID                'setting ID's and default menu-items
  171.   setDefaultMenuItemsArray
  172. End Sub
  173.  
  174. Sub setDefaultMenuItemsArray
  175.   addElement(WinampID)            'default Menu-items listed as shown in current order
  176.   addElement(PowerDVDID)
  177.   addElement(WinDVD5ID)
  178.   addElement(WinDVD4ID)
  179.   addElement(ZoomPlayerID)
  180.   addElement(iTunesID)
  181.   addElement(BSPlayerID)
  182.   addElement(MediaPlayerID)
  183.   addElement(WinTVID)
  184.   addElement(MoreTVID)
  185.   addElement(VolumeControlID)
  186.   addElement(MouseControlID)
  187.   addElement(PowerPointID)
  188.   addElement(MiscControlID)
  189.   addElement(MsAgentID)
  190. End Sub
  191.  
  192. Sub initID                'setting variables with application ID's
  193.   WinTVID = "WinTV"
  194.   MoreTVID = "More TV"
  195.   WinampID = "Winamp"
  196.   PowerDVDID = "PowerDVD"
  197.   WinDVD5ID = "InterVideo WinDVD 5"
  198.   WinDVD4ID = "InterVideo WinDVD 4"
  199.   ZoomPlayerID = "ZoomPlayer"
  200.   iTunesID = "iTunes"
  201.   BSPlayerID = "BSPlayer"
  202.   MediaPlayerID = "Media Player"
  203.   VolumeControlID = "Volume Control"
  204.   MouseControlID = "Mouse Control"
  205.   PowerPointID = "PowerPoint"
  206.   MiscControlID = "Misc Control"
  207.   MsAgentID = "Ms Agent"
  208. End Sub
  209.  
  210. Sub selectPhone
  211.   If (T610Enabled) Then                    'T610
  212.     ScreenWidth        = 111                'usable screenwidth
  213.     SpaceOption        = 3
  214.  
  215.     MenuItemExitMenu    = "      [ exit menu ]"
  216.     MenuItemBack    = "  <<<<  ( back )  >>>>"
  217.     MenuItemPrevSongs    = "===  prev songs  ==="
  218.     MenuItemNextSongs    = "===  next songs  ==="
  219.     MenuItemNext    = " <<<<< ( next ) >>>>>"
  220.     MenuItemPrev    = " <<<<< ( prev ) >>>>>"
  221.   Else                            'T68i
  222.     ScreenWidth        = 94                'usable screenwidth
  223.     SpaceOption        = 2
  224.  
  225.     MenuItemExitMenu    = "   <<< ( exit ) >>>"
  226.     MenuItemBack    = " <<< ( back ) >>>"
  227.     MenuItemPrevSongs    = " ==  prev songs  =="
  228.     MenuItemNextSongs    = "==   next songs   =="
  229.     MenuItemNext    = "   <<< ( next ) >>>"
  230.     MenuItemPrev    = "   <<< ( prev ) >>>"
  231.   End If
  232.   selectPixelArrays
  233. End Sub
  234.  
  235.  
  236. '***********************************************************
  237. Dim T610Enabled            'Boolean phone selection: true = t610 | false = t68i
  238.  
  239. Dim ScreenWidth            'phone dependable screen width
  240. Dim SpaceOption
  241.  
  242. Dim MenuItemExitMenu        'interface text
  243. Dim MenuItemBack
  244. Dim MenuItemNextSongs
  245. Dim MenuItemPrevSongs
  246. Dim MenuItemNext
  247. Dim MenuItemPrev
  248.  
  249. Dim ScriptVersion
  250. Dim SelectItem
  251.  
  252. Dim WinampState, WinampDir, WinampTitle
  253. Dim FLNbreFilesPage, FLCurDir, FLNumPage, FLNbrePage, FLTabFile(), FLNbreFile    'file launch variables
  254.  
  255. Dim MouseControlActive
  256.  
  257. Dim Fso, File            'file read and write variables
  258. Dim SettingsFile
  259. Dim ForReading
  260. Dim ForWriting
  261.  
  262. Dim SaveSettingsBool
  263. Dim SettingBackOption
  264.  
  265.  
  266. Dim VolumeCtrl            'objects
  267. Dim MouseCtrl
  268. Dim WinampCtrl
  269. Dim WinampVol
  270. Dim Shell
  271.  
  272. Dim WinTVOpen            'open app flags
  273. Dim MoreTVOpen
  274. Dim WinampOpen
  275. Dim PowerDVDOpen
  276. Dim BSPlayerOpen
  277. Dim ZoomPlayerOpen
  278. Dim MediaPlayerOpen
  279. Dim PPTOpen
  280.  
  281. Dim WinTVEXE            'Variables of application executables
  282. Dim MoreTVEXE
  283. Dim WinampEXE
  284. Dim PowerDVDEXE
  285. Dim BSPlayerEXE
  286. Dim PPTExe
  287. Dim ZoomPlayerExe
  288.  
  289. Dim BSPlayerZoom
  290.  
  291. ReDim ArrID(0)            'Array of application ID's     note: ArrID(0) is empty and not used for implementing reasons
  292. Dim iTunesID
  293. Dim WinTVID
  294. Dim MoreTVID
  295. Dim WinampID
  296. Dim PowerDVDID
  297. Dim WinDVD5ID
  298. Dim WinDVD4ID
  299. Dim ZoomPlayerID
  300. Dim BSPlayerID
  301. Dim MediaPlayerID
  302. Dim VolumeControlID
  303. Dim MouseControlID
  304. Dim PowerPointID
  305. Dim MiscControlID
  306. Dim MsAgentID
  307.  
  308. ' "T610 as a webcam". Copyright (c) 2004 HRS.
  309.  
  310. ' this script remotely triggers the camera of the T610,
  311. ' transfers the taken picture on the local pc and
  312. ' deletes it from the camera.
  313.  
  314. ' path and filename of the picture on the camera
  315. Dim filename
  316.  
  317. ' output directory for the transferred files on the local pc
  318. ' terminating backslash required
  319. Dim outputdirectory
  320.  
  321. Sub OnInit
  322.   'Reapply settings (usualy after editing the script inside FMA)
  323.   OnDisconnected
  324.   OnConnected
  325.  
  326.   'Add main menu options
  327.   fma.AddCmd "How to build your own scripts?", "OnFMAScriptHowto"
  328.   fma.AddCmd "-", ""
  329.   fma.AddCmd "Start Webcam mode", "OnStartWebcam"
  330.   fma.AddCmd "Stop Webcam mode", "OnStopWebcam"
  331.   fma.AddCmd "-", ""
  332.   fma.AddCmd "Take a picture", "OnTakeSinglePicture"
  333.   fma.AddCmd "-", ""
  334.   fma.AddCmd "Locate the phone", "OnLocatePhone"
  335. End Sub
  336.  
  337. sub OnFMAScriptHowto
  338. ' Set shell = CreateObject("WScript.Shell")
  339.   shell.Run "IExplore.exe http://fma.sourceforge.net/resources/docs/scripts_sdk.htm"
  340. end sub
  341.  
  342. Sub OnConnected
  343.   ReDim ArrID(0)
  344.  
  345.   ForReading = 1
  346.   ForWriting = 2
  347.  
  348.   ' PLEASE, LOCALIZE filename PATH AND FILENAME !!!
  349.   filename = "/Pictures/Image(1).jpg"
  350.   outputdirectory = "C:\"
  351.  
  352.   'OnConnected is called in offline mode from OnInit
  353.   'so we should take care of this
  354.   If fma.Connected = 1 Then
  355.      am.Init                             'Initialize the Accessories Menu
  356.      am.DlgMsgBox "Connected to floAt's Mobile Agent", 2
  357.   Else
  358.      am.Clear
  359.   End If
  360.   
  361.   Set Shell = CreateObject("WScript.Shell")
  362.   Set Fso = CreateObject("Scripting.FileSystemObject")        'FileSystemObject created for reading and writing files
  363.  
  364.   Set VolumeCtrl = CreateObject("floAtMediaCtrl.VolumeCtrl")
  365.   Set MouseCtrl = CreateObject("floAtMediaCtrl.MouseCtrl")
  366.   Set WinampCtrl = CreateObject("WinampCOMLib.WinampCOMObj")
  367.   
  368. ' -------------------------- added by CarpeDi3m1687----------------------------
  369.  
  370.  
  371. '*********** Change these settings as required ************
  372.  
  373.   SettingsFile = "C:\CarpeDi3m1687.sav"        'file-location for saving user-settings
  374.  
  375.   ' WinAmp
  376.   WinampTitle = "Winamp 5.07"
  377.   WinampDir = "C:\Program Files\Winamp5"    'Location of WinAmp.exe
  378.   FLCurDir  = "C:\Program Files\Winamp5"    'Location of m3u playlists
  379.   WinampCtrl.PathExe = WinampDir               'Winamp 2x    directory-path
  380.   WinampEXE = "C:\Progra~1\Winamp5\winamp.exe" 'Winamp 2x    exe-path
  381.  
  382.   ' Other Apps
  383.   WinTVEXE = "C:\Progra~1\WinTV\WinTV2K.EXE"            'WinTV        exe-path
  384.   MoreTVEXE = "C:\Progra~1\MoreTV.353\MoreTV.exe"        'MoreTV        exe-path
  385.   PowerDVDEXE = "C:\Progra~1\CyberLink\PowerDVD\PowerDVD.EXE"    'PowerDVD    exe-path
  386.   BSPlayerEXE = "C:\Progra~1\BSPlayer\bplay.exe"        'BSPlayer    exe-path
  387.   PPTExe = "C:\Progra~1\Micros~1\Office11\PowerPnt.exe"        'PowerPoint    exe-path ('office11' = office 2003)
  388.   ZoomPlayerExe = "C:\Progra~1\ZoomPl~1\zplayer.exe"        'Zoom Player    exe-path
  389.  
  390. '***********************************************************
  391.  
  392.   setDefault            'set default user settings
  393.   readSettings            'read stored user settings (if config file is available)
  394.   
  395.   BSPlayerZoom = 1
  396.  
  397.   WinampVol = 128
  398.   WinampCtrl.SetVolume = WinampVol
  399.  
  400. ' -------------------------- added by CarpeDi3m1687----------------------------
  401.  
  402.   If fma.Connected = 1 Then
  403.      Transmit "AT*EAST=" + Chr(34) + "Fma Remote" + Chr(34)
  404.   End If
  405.  
  406.   MouseControlActive = 0
  407.  
  408. End Sub
  409.  
  410. Sub OnDisconnected
  411.   Set Shell = Nothing
  412.   Set Fso = Nothing            ' is this one needed????
  413.   Set VolumeCtrl = Nothing
  414.   Set MouseCtrl = Nothing
  415.   Set WinampCtrl = Nothing
  416. End Sub
  417.  
  418. Sub OnMusicMute(Start)
  419.   If Start = 1 Then
  420.     WinampState = WinampCtrl.GetSongState
  421.     If WinampState = "playing" Then
  422.       WinampCtrl.Pause
  423.     End If
  424.   Else
  425.     If WinampState = "playing" Then
  426.       WinampCtrl.Pause
  427.     End If
  428.   End If
  429. End Sub
  430.  
  431.  
  432. 'Active Menu Start ---------------------------------------------------------
  433. 'onAMRoot will be called when Connection/Extra->Accessories->FMA is selected
  434. 'Something that's not shown here is am.Back = "Event", will call procedure
  435. 'specified rather than go back to the previous menu
  436.  
  437.  
  438. Sub OnAMRoot
  439.   am.Clear
  440.   If (T610Enabled) Then
  441.    am.Title = "T610 control"
  442.   Else
  443.    am.Title = "T68i control"
  444.   End If
  445.  
  446.   setRootMenuItems
  447.  
  448.   am.AddItem center("[ Settings ]"), "onAMSettings"
  449.   am.AddItem center("[ about ]"), "about"
  450.  
  451.   am.Update
  452. End Sub
  453.  
  454. Sub about
  455.   Dim title, text, text2, text3, text4, text5
  456.   title = "about"
  457.   
  458.   If (T610Enabled) Then
  459.     text1 = "   CarpediWebMouse   "
  460.     text2 = Space(38)
  461.     text3 = Space(38)
  462.     text4 = "     Version " & ScriptVersion
  463.     text5 = ""
  464.   Else
  465.     text1 = "  CarpediWebMouse  "
  466.     text2 = Space(34)
  467.     text3 = Space(34)
  468.     text4 = "    Version " & ScriptVersion
  469.     text5 = ""
  470.   End If
  471.  
  472.   text = text1 & text2 & text3 & text4 & text5
  473.  
  474.   am.back = "OnAMRoot"
  475.   DlgInformation title, text
  476. End Sub
  477.  
  478.  
  479. '-------------------Winamp Control (made by CarpeDi3m1687 version 2.0a)---------
  480.  
  481. Dim Pos
  482.  
  483. Dim Arr10, Arr9, Arr8, Arr7, Arr6, Arr5, Arr4, Arr3, Arr2, Arr1    'pixelArrays sorted by common and
  484.  
  485.  
  486. Sub selectPixelArrays
  487.   If (T610Enabled) Then
  488.     Arr1=Array("")
  489.     Arr2=Array("i","l",".",",","!","'","I","|",":",";","_"," ")
  490.     Arr3=Array("j","(",")","[","]")
  491.     Arr4=Array("f","r","t","{","}","-")
  492.     Arr5=Array("c","s","z","Z","/","1","<",">","=")
  493.     Arr6=Array("a","b","d","e","g","h","k","n","o","p","q","u","x","y","A","B","C","D","E","F","G","H","J","K","L","O","P","R","S","T","U","Y","?","^","$","+","0","2","3","4","5","6","7","8","9")
  494.     Arr7=Array("v","N","Q","V","X","&","0")
  495.     Arr8=Array("@","%")
  496.     Arr9=Array("M")
  497.     Arr10=Array("m","w","W")
  498.   Else
  499.     Arr1=Array("i","I","l","!",".","'","|")
  500.     Arr2=Array(" ","f","j","t","(",")",":",",","[","]",";")
  501.     Arr3=Array("r","-","/","{","}")
  502.     Arr4=Array("c","k","s","x","z","J","_")
  503.     Arr5=Array("a","e","o","u","y","b","d","g","h","n","p","q","v","E","B","F","L","S","T","Z","*","0","1","2","3","4","5","6","7","8","9","?","&","^","+","=","<",">")
  504.     Arr6=Array("O","U","C","D","G","H","K","N","P","R","Q","~")
  505.     Arr7=Array("m","w","A","M","Y","V","X","M","%")
  506.     Arr8=Array("@","#")
  507.     Arr9=Array("W")
  508.     Arr10=Array("")
  509.   End If
  510. End Sub
  511.  
  512.  
  513. '------------------ winamp main menu ----------------------
  514.  
  515. Sub onAMWinamp
  516.   WinampOpen = shell.AppActivate(WinampTitle)
  517.   am.Clear
  518.   winampMenu 
  519. End Sub
  520.  
  521. Sub winampMenu
  522.   am.ClearMenu
  523.   am.Title = WinampTitle
  524.  
  525.   If(SelectItem>0) Then
  526.     am.Selected = SelectItem 
  527.     SelectItem = 0
  528.   End If
  529.  
  530.   If (WinampOpen) Then
  531.      am.AddItem "PlayList", "onAMPlayList"
  532.      am.AddItem "Play", "onWinampPlay"
  533.      am.AddItem "Pause", "onWinampPause"
  534.      am.AddItem "Prev Track", "onWinampPrevTrack"
  535.      am.AddItem "Next Track", "onWinampNextTrack"
  536.      am.AddItem "Volume", "onWinampSlideVol"
  537.      am.AddItem "Seek (buggy)", "enterSlide"
  538.      am.AddItem "Album", "FileLauncherDir"
  539.      am.AddItem "Options", "onAMWinampOptions"
  540.      am.AddItem "Close Winamp", "OnWinampClose"
  541.   Else
  542.     am.AddItem "Launch Winamp", "OnWinampLaunch"
  543.   End If
  544.   If (SettingBackOption) Then am.AddItem MenuItemBack, "onAMRoot"
  545.  
  546.   am.Back = "onAMRoot"
  547.   am.Update
  548. End Sub
  549.  
  550. Sub onWinampLaunch
  551.   shell.Run WinampEXE
  552.   WinampOpen = TRUE
  553.   winampMenu 
  554. End Sub
  555.  
  556. Sub onWinampClose
  557.   shell.SendKeys("%{F4}")
  558.   WinampOpen = FALSE
  559.   winampMenu 
  560. End Sub
  561.  
  562. Sub onWinampPlay
  563.   WinampCtrl.Play
  564.   am.Update
  565. End Sub
  566.  
  567. Sub onWinampPause
  568.   WinampCtrl.Pause
  569.   am.Update
  570. End Sub
  571.  
  572. Sub onWinampPrevTrack
  573.   WinampCtrl.PreviousTrack
  574.   am.Update
  575. End Sub
  576.  
  577. Sub onWinampNextTrack
  578.   WinampCtrl.NextTrack
  579.   am.Update
  580. End Sub
  581.  
  582. sub FileLauncherDir
  583.  dim fol
  584.  dim fi,f
  585.  Set fol = Fso.GetFolder(FLCurDir)
  586.  Set fi = fol.Files
  587.  FLNbreFilesPage = 6
  588.  
  589.  FLNbreFile = fol.Files.Count
  590.  FLNbrePage = Int(FLNbreFile / FLNbreFilesPage) + 1
  591.  If FLNbreFile Mod FLNbreFilesPage = 0 Then FLNbrePage = FLNbrePage - 1
  592.  FLNumPage = 0
  593.  
  594.  ReDim FLTabFile(FLNbreFile,2)
  595.  
  596.  Dim cpt
  597.  cpt = 0
  598.  
  599.  For Each f In fi
  600.   FLTabFile(cpt, 0) = f.Name
  601.   FLTabFile(cpt, 1) = f.ShortPath
  602.   cpt = cpt + 1
  603.  Next
  604.  Set fol = Nothing
  605.  Set fi = Nothing
  606.  FLNumPage = 0
  607.  FileLauncherPage
  608. end sub
  609.  
  610. sub FileLauncherPage
  611.  dim inc,a
  612.  inc = FLNumPage * FLNbreFilesPage
  613.  
  614.  am.Clear
  615.  am.Title = "Files (" & (FLNumPage + 1) & "/" & FLNbrePage & ")"
  616.  
  617.  am.AddItem "---- Prev page ----", "FileLauncherPageup"
  618.  
  619.  if FLNumPage + 1 <> FLNbrePage then
  620.   for a = 0 to (FLNbreFilesPage - 1)
  621.   'am.AddItem PrepareText(FLTabFile(inc + a, 0)), "FileLauncherLoad" & a
  622.    am.AddItem FLTabFile(inc + a, 0), "FileLauncherLoad" & a
  623.   next
  624.  else
  625.   for a = 0 to (FLNbreFile - inc) - 1
  626.   'am.AddItem PrepareText(FLTabFile(inc + a, 0)), "FileLauncherLoad" & a
  627.    am.AddItem FLTabFile(inc + a, 0), "FileLauncherLoad" & a
  628.   next
  629.  end if
  630.  am.AddItem "---- Next page ----", "FileLauncherPagedown"
  631.  am.Back = "onAMWinamp"
  632.  am.Update
  633. end sub
  634.  
  635. sub FileLauncherPageup
  636.  if FLNumPage = 0 then
  637.   FLNumPage = FLNbrePage - 1
  638.  else
  639.   FLNumPage = FLNumPage -1
  640.  end if
  641.  FileLauncherPage
  642. end sub
  643.  
  644. sub FileLauncherPagedown
  645.  if FLNumPage = FLNbrePage - 1 then
  646.   FLNumPage = 0
  647.  else
  648.   FLNumPage = FLNumPage + 1
  649.  end if
  650.  FileLauncherPage
  651. end sub
  652.  
  653. sub FileLauncherLoad0
  654.  dim width
  655.  width = 5
  656.  shell.run FLTabFile( (FLNumPage * FLNbreFilesPage) , 1 )
  657.  
  658.  fma.sleep (5000)
  659.  onAMPlayList
  660.  am.Update
  661. end sub
  662.  
  663. sub FileLauncherLoad1
  664.  dim width
  665.  width = 5
  666.  shell.run FLTabFile( ((FLNumPage * FLNbreFilesPage) + 1) , 1)
  667.  
  668.  fma.sleep (5000)
  669.  onAMPlayList
  670.  am.Update
  671. end sub
  672.  
  673. sub FileLauncherLoad2
  674.  dim width
  675.  width = 5
  676.  shell.run FLTabFile( ((FLNumPage * FLNbreFilesPage) + 2) , 1)
  677.  
  678.  fma.sleep (5000)
  679.  onAMPlayList
  680.  am.Update
  681. end sub
  682.  
  683. sub FileLauncherLoad3
  684.  dim width
  685.  width = 5
  686.  shell.run FLTabFile( ((FLNumPage * FLNbreFilesPage) + 3) , 1)
  687.  
  688.  fma.sleep (5000)
  689.  onAMPlayList
  690.  am.Update
  691. end sub
  692.  
  693. sub FileLauncherLoad4
  694.  dim width
  695.  width = 5
  696.  shell.run FLTabFile( ((FLNumPage * FLNbreFilesPage) + 4) , 1)
  697.  
  698.  fma.sleep (5000)
  699.  onAMPlayList
  700.  am.Update
  701. end sub
  702.  
  703. sub FileLauncherLoad5
  704.  dim width
  705.  width = 5
  706.  shell.run FLTabFile( ((FLNumPage * FLNbreFilesPage) + 5) , 1)
  707.  
  708.  fma.sleep (5000)
  709.  onAMPlayList
  710.  am.Update
  711. end sub
  712.  
  713. sub FileLauncherLoad6
  714.  dim width
  715.  width = 5
  716.  shell.run FLTabFile( ((FLNumPage * FLNbreFilesPage) + 6) , 1)
  717.  
  718.  fma.sleep (5000)
  719.  onAMPlayList
  720.  am.Update
  721. end sub
  722.  
  723. '------------------ playlist ------------------------------
  724.  
  725. Sub onAMPlayList
  726.   If (WinampCtrl.GetPlayListLength > 0) Then            'Playlist is not empty
  727.     Pos = WinampCtrl.GetPlayListPosition - 1
  728.     WinampCtrl.GetPlayList                'add to speeed up
  729.     playList(Pos)
  730.   End If
  731.   am.Update
  732. End Sub
  733.  
  734. Sub playList(p)
  735.   Dim Show, Length
  736.  
  737.   am.Clear
  738.   am.Title = "Playlist: " & CStr(p+1)
  739.  
  740.  
  741.   Pos = p                                'var needed to pass to functions: prevSongs, nextSongs, playSongs(1..9) 
  742.  
  743.   'WinampCtrl.GetPlayList                        'remove to speed up remove only if no adding or removing songs during playlist use (2000+ songs
  744.   Length = WinampCtrl.GetPlayListLength
  745.   Show = Length - p                            'songs to be shown, remaining songs
  746.  
  747.   If (p > 0) Then am.AddItem MenuItemPrevSongs, "prevSongs"        'if first song of playlist is not shown
  748.  
  749.   If (Show > 0) Then am.AddItem getSong(p), "playSong1"
  750.   If (Show > 1) Then am.AddItem getSong(p+1), "playSong2"
  751.   If (Show > 2) Then am.AddItem getSong(p+2), "playSong3"
  752.   If (Show > 3) Then am.AddItem getSong(p+3), "playSong4"
  753.   If (Show > 4) Then am.AddItem getSong(p+4), "playSong5"
  754.   If (Show > 5) Then am.AddItem getSong(p+5), "playSong6"
  755.   If (Show > 6) Then am.AddItem getSong(p+6), "playSong7"
  756.   If (Show > 7) Then am.AddItem getSong(p+7), "playSong8"
  757.  
  758.   If ( (Show>8 and p=0) Or (Show=9) ) Then am.AddItem getSong(p+8), "playSong9"
  759.  
  760.   If (Length=10 and p=0) Then
  761.     am.AddItem getSong(p+9), "playSong10"
  762.   ElseIf (Show > 9) Then                    'Length <> 10
  763.     am.AddItem MenuItemNextSongs, "nextSongs"        'if there are more then 10 remaining songs
  764.   End If
  765.  
  766.   am.Back = "onAMWinamp"
  767.   am.Update
  768. End Sub
  769.  
  770. Sub prevSongs
  771.   Pos = Pos-8                'back 8 songs   what if there are 18 songs? and Show =9
  772.   If (Pos<2) Then Pos = 0
  773.  
  774.   playList(Pos)                'Show new playlist with song# (Pos) as top of the list
  775. End Sub
  776.  
  777.  
  778. Sub nextSongs
  779.   If (Pos = 0) Then    'forward 9 songs if at beginning of list
  780.     Pos=Pos+9
  781.   Else
  782.     Pos=Pos+8        'forward 8 songs if not at beginning of list
  783.   End If
  784.   playList(Pos)        'Show new playlist with song# (Pos) as top of the list
  785. End Sub
  786.  
  787.  
  788. Sub playSong1        'clicked on song-event
  789.   playSong(Pos)        'play song being shown on top (Pos = value top song)
  790. End Sub
  791.  
  792. Sub playSong2        'clicked on song-event
  793.   playSong(Pos+1)    'play song being shown on top as 2nd   (Pos = value top song) + 1 offset
  794. End Sub
  795.  
  796. Sub playSong3
  797.   playSong(Pos+2)
  798. End Sub
  799.  
  800. Sub playSong4
  801.   playSong(Pos+3)
  802. End Sub
  803.  
  804. Sub playSong5
  805.   playSong(Pos+4)
  806. End Sub
  807.  
  808. Sub playSong6
  809.   playSong(Pos+5)
  810. End Sub
  811.  
  812. Sub playSong7
  813.   playSong(Pos+6)
  814. End Sub
  815.  
  816. Sub playSong8
  817.   playSong(Pos+7)
  818. End Sub
  819.  
  820. Sub playSong9
  821.   playSong(Pos+8)
  822. End Sub
  823.  
  824. Sub playSong10
  825.   playSong(Pos+9)
  826. End Sub
  827.  
  828.  
  829. Sub playSong(i)                                            'function called by clicked on song events song
  830.   If ( (WinampCtrl.GetSongState = "playing") And (WinampCtrl.GetPlayListPosition-1 = i) ) Then    'clicked on a song that is being played then show song info
  831.     songInfo(i)
  832.   Else                                                'if song is not being played
  833.     WinampCtrl.PlaySongByPosition(i)                                 'then play song and
  834.     playList(i)                                            'show playlist with song# i at top of list
  835.   End If
  836. End Sub
  837.  
  838.  
  839.  
  840. Function getSong(p)                'return songtitle of song p
  841.   Dim i ,limit ,Str ,s ,size, width, mark
  842.   Width = ScreenWidth-13            'width available pixels t610:112 t68i = 94
  843.  
  844.   s = filter(WinampCtrl.GetSongTitlebyPosition(p))
  845.   s = replace(s,"( ","(")        'reading songs with " char causes lockup
  846.   s = replace(s," )",")")        'reading songs with " char causes lockup
  847.   s = replace(s,"[ ","[")        'reading songs with " char causes lockup
  848.   Str = replace(s," ]","]")        'reading songs with " char causes lockup
  849.  
  850.   limit = Len(str)
  851.  
  852.   If (WinampCtrl.GetPlayListPosition-1 = p) Then    'if P is current song being played
  853.     mark = ">"                        'mark song
  854.   Else
  855.     mark = "  "
  856.   End If
  857.  
  858.   For i=1 to limit                    'for part to determine last char that fits onto screen
  859.     size = size + pixelsOf(Mid(str,i,1))
  860.  
  861.     If (size > width) Then
  862.       getSong = mark & Left(str,i-1)
  863.       Exit Function
  864.     End If
  865.   Next
  866.  
  867.   getSong = mark & str
  868. End Function
  869.  
  870.  
  871. Function filter(str)                'filters a String
  872.   Dim s, i, i2
  873.   s = Trim(Str)
  874.   
  875. '  i = InStr(1, s, "XTINF", 1)
  876. '  If (i = 1) Then                'files without id3 tags and not able to extract song - artist from fileName
  877. '    i2 = InStr(1, s, ",", 1) + 1
  878. '    filter = Mid(s, i2)
  879. '    Exit Function
  880. '  End If
  881.  
  882.   filter = replace(s,Chr(34),"''")        'reading songs with " char causes lockup
  883.  
  884.   
  885.   
  886. End Function
  887.  
  888.  
  889.  
  890. '------------------ Playlist ------------------------------
  891.  
  892.  
  893. '------------------ String Pixels calculation -------------
  894.  
  895. Function strPix(str)                'return #pixels needed to display string
  896.   Dim i, limit, size
  897.   limit = Len(str)
  898.   For i=1 to limit
  899.     size = size + pixelsOf(Mid(str,i,1))
  900.   Next
  901.   strPix = size
  902. End Function
  903.  
  904. Function strPix2(str,max)            'return #pixels needed to display string and 
  905.   Dim i, limit, size
  906.   limit = Len(str)
  907.   For i=1 to limit
  908.     size = size + pixelsOf(Mid(str,i,1))
  909.  
  910.     If (size > max) Then            'return -1 if max value is passed (overflow)
  911.       strPix2 = -1
  912.       Exit Function
  913.     End If
  914.  
  915.   Next
  916.   strPix2 = size
  917. End Function
  918.  
  919. Function pixelsOf(c)                'return #pixels needed to display a character
  920.   If elementOf(c,Arr5) Then
  921.     pixelsOf = 6                'Arr5 is filled with elements that takes 5 pixels + 1 blank pixel
  922.   ElseIf elementOf(c,Arr2) Then
  923.     pixelsOf = 3
  924.   ElseIf elementOf(c,Arr1) Then
  925.     pixelsOf = 2
  926.   ElseIf elementOf(c,Arr4) Then
  927.     pixelsOf = 5
  928.   ElseIf elementOf(c,Arr6) Then
  929.     pixelsOf = 7
  930.   ElseIf elementOf(c,Arr7) Then
  931.     pixelsOf = 8
  932.   ElseIf elementOf(c,Arr10) Then
  933.     pixelsOf = 11
  934.   ElseIf elementOf(c,Arr9) Then
  935.     pixelsOf = 10
  936.   ElseIf elementOf(c,Arr8) Then
  937.     pixelsOf = 9
  938.   ElseIf elementOf(c,Arr3) Then
  939.     pixelsOf = 4
  940.   Else
  941.     pixelsOf = 7
  942.   End If
  943. End Function
  944.  
  945. Function elementOf(c,arr)    'determines whether 'c' is element of Array
  946.   Dim e
  947.  
  948.   For each e in arr
  949.     If (c = e) Then
  950.       elementOf = TRUE
  951.       Exit Function
  952.     End If
  953.   Next
  954.  
  955.   elementOf = FALSE
  956. End Function
  957.  
  958. '------------------ String Pixels calculation -------------
  959.  
  960.  
  961. '------------------ songInfo ------------------------------
  962.  
  963. Sub songInfo(i)                            'show song info of song# i
  964.   Dim arrSong, arrArtist, tempArr
  965.   Dim artist, song, track, length, line1, line2, line3, line4, line5, line6, line7
  966.  
  967.   WinampCtrl.SetLengthParseTime = TRUE                'sets return of WinampCtrl.GetSongLength to (h:m:s)
  968.  
  969.   song = Filter(WinampCtrl.GetSongTitleByPosition(i))
  970.  
  971.   artist = Filter(WinampCtrl.GetArtistByPosition(i))
  972.  
  973.   track = " [ " & WinampCtrl.GetPlayListPosition & " of " & WinampCtrl.GetPlayListLength & " ] "
  974.   length = " ( " & WinampCtrl.GetSongLength & " ) "
  975.   
  976.   arrSong = splitString(song)
  977.   arrArtist = splitString(artist)
  978.  
  979.  
  980.   line1 = center2(track)
  981.   line2 = center(arrSong(0))
  982.   line3 = center(arrSong(1))
  983.   line4 = center("-")
  984.   line5 = center(arrArtist(0))
  985.   line6 = center(arrArtist(1))
  986.  
  987.   If (arrSong(1) = "") Then
  988.     If (arrArtist(1) = "") Then
  989.       line3 = line2
  990.       line2 = ""
  991.  
  992.     ElseIf ( strPix2(arrArtist(1),ScreenWidth) = -1 ) Then
  993.       tempArr = splitString(arrArtist(1))
  994.  
  995.       line3 = line4
  996.       line4 = line5
  997.       line5 = center(tempArr(0))
  998.       line6 = center(tempArr(1))
  999.     End If
  1000.  
  1001.   ElseIf ( (strPix2(arrSong(1),ScreenWidth) = -1) And (arrArtist(1) = "") ) Then
  1002.     tempArr = splitString(arrSong(1))
  1003.  
  1004.     line6 = line5
  1005.     line5 = line4
  1006.     line3 = center(tempArr(0))
  1007.     line4 = center(tempArr(1))
  1008.   End If
  1009.  
  1010.   line7 = center2(length)
  1011.   
  1012.   If (T610Enabled) Then
  1013.     boxT610 "Song Info" ,line1 ,line2 ,line3 ,line4 ,line5 ,line6 ,line7
  1014.   Else
  1015.     boxT68i "Song Info" ,line1 ,line2 ,line3 ,line4 ,line5 ,line6 ,line7
  1016.   End If
  1017.  
  1018.   am.Back = "onAMPlayList"
  1019.   am.Update
  1020. End Sub
  1021.  
  1022.  
  1023. Function splitString(s)        'split string into two parts and return an Array with 2 elements (#chars of first element <= width)
  1024.   Dim s1 ,s2 ,size ,lw ,words, break, temps
  1025.  
  1026.   If (strPix2(s,ScreenWidth) <> -1) Then        'count pixs of string with maximum of screenwidth
  1027.     splitString = Array(s,"")
  1028.  
  1029.   Else                    'string larger then screenwidth pixs
  1030.     break = FALSE
  1031.     words = split(s)
  1032.  
  1033.     For each w in words
  1034.       If (break) Then            'build up string 2
  1035.         s2 = s2 & w & " "
  1036.  
  1037. '    If (Left(w,1) = "(" ) Then    ' proper break ( , [ signs
  1038. '        temps = w
  1039.           
  1040. '    End If
  1041.  
  1042.  
  1043.       Else
  1044.         lw = strPix(w)
  1045.  
  1046. '    If ((Left(w,1) = "(" ) and (Size + lw > 86)) Then    'proper break ( , [ signs
  1047. '         break = TRUE
  1048. '      s2 = w + " "
  1049.  
  1050.         If (size + lw > ScreenWidth) Then                'condition that determines border between string 1 and string 2
  1051.           break = TRUE
  1052.           s2 = s2 & w & " "
  1053.     Else
  1054.           s1 = s1 & w & " "
  1055.           size = size + lw + 3
  1056.         End If
  1057.       End If
  1058.     Next
  1059.  
  1060.     splitString = Array(RTrim(s1),RTrim(s2))
  1061.   End If
  1062. End Function
  1063.  
  1064.  
  1065. Function splitStringOptimized(s)        'split string into two parts and return an Array with 2 elements (#chars of first element <= width)
  1066.   Dim s1 ,s2 ,size ,lw ,words, break, temps
  1067.  
  1068.   Size = 0
  1069.   s1 = ""
  1070.   s2 = ""
  1071.   break = FALSE
  1072.   words = split(s)
  1073.  
  1074.   For each w in words
  1075.     If (break) Then            'build up string 2
  1076.       s2 = s2 & w & " "
  1077.  
  1078. '     If (Left(w,1) = "(" ) Then    ' proper break ( , [ signs
  1079. '       temps = w
  1080.           
  1081. '    End If
  1082.  
  1083.  
  1084.     Else
  1085.       lw = strPix(w)            'count pix of word
  1086.  
  1087. '     If ((Left(w,1) = "(" ) and (Size + lw > 86)) Then    'proper break ( , [ signs
  1088. '       break = TRUE
  1089. '    s2 = w & " "
  1090.  
  1091.         If (size + lw > ScreenWidth) Then    'condition that determines border between string 1 and string 2
  1092.           break = TRUE
  1093.           s2 = s2 & w & " "        'word belongs to string 2
  1094.     Else
  1095.           s1 = s1 & w & " "
  1096.           size = size + lw + 3
  1097.         End If
  1098.       End If
  1099.     Next
  1100.  
  1101.     splitString = Array(RTrim(s1),RTrim(s2))
  1102. End Function
  1103.  
  1104.  
  1105.  
  1106. '------------------ center functions ----------------------
  1107.  
  1108. Function center(str)        'center str with spaces at left
  1109.   Dim s, pixs
  1110.   pixs = strPix2(str,ScreenWidth)    'count pixs of string with maximum of screenwidth
  1111.  
  1112.   If (pixs = -1) Then        'if #str is larger dan screenwidth  (overflow)
  1113.     center = str
  1114.     Exit Function
  1115.   Else
  1116.     s = (ScreenWidth - pixs)\6        'determine number of spaces at left side (remaining pixels div. by 2*3 space pixels)
  1117.     center = Space(s) & str
  1118.   End If
  1119. End Function
  1120.  
  1121.  
  1122. Function center2(str)        'center str with ½ sign at left and ╗ at right side
  1123.   Dim i, r, s, pixs
  1124.   pixs = strPix2(str,ScreenWidth)    'count pixs of string with maximum of screenwidth
  1125.  
  1126.   If (pixs = -1) Then        'if #str is larger dan screenwidth  (overflow)
  1127.     center2 = str
  1128.     Exit Function
  1129.   Else
  1130.     r = ScreenWidth - pixs        'remaining pixels
  1131.  
  1132.     If (T610Enabled) Then    't610
  1133.         i = r\10
  1134.         s = (r - i*10)\6
  1135.     Else            't68i
  1136.         i = r\8
  1137.         s = (r - i*8)\6
  1138.     End If
  1139.  
  1140.     center2 = Space(s) & String(i,"-") & str & String(i,"-")
  1141.   End If
  1142. End Function
  1143.  
  1144.  
  1145.  
  1146. '------------------ SongInfo screen -----------------------
  1147.  
  1148. Sub boxT68i(title,line1,line2,line3,line4,line5,line6,line7)    'function needed for songinfo function (opens new window)
  1149.   am.clear
  1150.   am.Title = title
  1151.  
  1152.   am.AddItem line1, "exitSongInfo"
  1153.   am.AddItem line2, "exitSongInfo"
  1154.   am.AddItem line3, "exitSongInfo"
  1155.   am.AddItem line4, "exitSongInfo"
  1156.   am.AddItem line5, "exitSongInfo"    
  1157.   am.AddItem line6, "exitSongInfo"
  1158.   am.AddItem line7, "exitSongInfo"
  1159.   am.Update
  1160. End Sub
  1161.  
  1162.  
  1163. Sub boxT610(title,line1,line2,line3,line4,line5,line6,line7)    'function needed for songinfo function (opens new window)
  1164.   Dim SongOneLine
  1165.   Dim ArtistOneLine
  1166.  
  1167.   am.clear
  1168.   am.Title = title
  1169.   am.AddItem line1, "exitSongInfo"
  1170.  
  1171.   SongOneLine = (Trim(line2) = "") Or (Trim(line3) = "")
  1172.   ArtistOneLine = (Trim(line6) = "")
  1173.   
  1174.   If ((Not SongOneLine) Or ArtistOneLine) Then    'song multiple lines
  1175.     am.AddItem line2, "exitSongInfo"
  1176.   Else
  1177.     Line3 = line2
  1178.   End If
  1179.  
  1180.   am.AddItem line3, "exitSongInfo"
  1181.   am.AddItem line4, "exitSongInfo"
  1182.  
  1183.   If (Not ArtistOneLine) Then         'Artist multiple lines
  1184.     am.AddItem line5, "exitSongInfo"
  1185.   Else                     'Artist single line
  1186.     Line6 = line5
  1187.   End If
  1188.   am.AddItem line6, "exitSongInfo"
  1189.   am.AddItem line7, "exitSongInfo"
  1190.   am.Update
  1191. End Sub
  1192.  
  1193. Sub exitSongInfo
  1194.   playlist(WinampCtrl.GetPlayListPosition-1)
  1195. End Sub
  1196.  
  1197.  
  1198.  
  1199. '---------------------------- Seek (beta 0.1) -------------------------------------
  1200.  
  1201. Dim Showbar, NeededBars
  1202. Dim RemSteps            'remaining steps to be shown at the last bar
  1203.  
  1204. Dim SavePos            'index of current song being played in the list
  1205.  
  1206.  
  1207.  
  1208. Sub enterSlide
  1209.   Dim p, steps, secPos
  1210.  
  1211.   WinampCtrl.SetLengthParseTime = FALSE
  1212.   steps = WinampCtrl.GetSongLength\10
  1213.   RemSteps = steps mod 6
  1214.   NeededBars = (steps\6) + 1
  1215.   SavePos = WinampCtrl.GetPlayListPosition
  1216.  
  1217.   WinampCtrl.SongPosParseTime = FALSE
  1218.  
  1219.   secPos = (WinampCtrl.GetSongPosition\10000)        '10sec units
  1220.  
  1221.   p = secPos mod 6                    'Set step for slideScan
  1222.  
  1223.   Showbar = (secPos\6) + 1                'Set current bar to be shown
  1224.  
  1225.   WinampCtrl.SetLengthParseTime = TRUE             'Needed in slideScan
  1226.  
  1227.   slideScan(p)
  1228. End Sub
  1229.  
  1230.  
  1231. Sub slideScan(i)
  1232.   Dim title, steps
  1233.  
  1234.   title = "(" & Cstr(Showbar-1) & ":00)" & "  " & WinampCtrl.GetSongLength
  1235.  
  1236.   If(Showbar = NeededBars) Then                'last bar shown steps
  1237.     steps = RemSteps
  1238.   Else
  1239.     steps = 6
  1240.   End If
  1241.  
  1242.   am.DlgPercent title, "winampScanEvent", steps, i
  1243. End Sub
  1244.  
  1245.  
  1246. Sub winampScanEvent(value, final)
  1247.   Dim JumpTo, ShowLastBar
  1248.  
  1249.   If (final = 1) Then
  1250.     winampMenu
  1251.  
  1252.   ElseIf(SavePos <> WinampCtrl.GetPlayListPosition) Then    'a new song is played
  1253.     enterSlide
  1254.  
  1255.   Else
  1256.     ShowLastBar = (Showbar = NeededBars)
  1257.     If (ShowLastBar) Then                                                        'last bar shown
  1258.       JumpTo = (((Showbar-1)*600) + (value*RemSteps) )*100
  1259.     Else
  1260.       JumpTo = ((Showbar-1)*100 + value )*600
  1261.     End If
  1262.  
  1263.  
  1264.     If (WinampCtrl.JumpToTime(JumpTo) = 0) Then        '0 = succes, -1 = not playing, 1 = eof
  1265.       If (value = 100) Then                'end of bar
  1266.         If (Not ShowLastBar) Then                'end of last bar
  1267.           Showbar = Showbar + 1
  1268.           slideScan(0)
  1269.         End If
  1270.  
  1271.       ElseIf ((value = 0) and (Showbar <> 1)) Then    'begin of first bar
  1272.         Showbar = Showbar - 1
  1273.         slideScan(6)
  1274.       End If
  1275.     Else                        'not playing || eof
  1276.       WinampCtrl.Play
  1277.     End If
  1278.  
  1279.   End If
  1280. End Sub
  1281.  
  1282.  
  1283. '------------------ winamp volume control -----------------
  1284.  
  1285. Sub onWinampSlideVol                    'Winamp volume slider
  1286.   am.DlgPercent "Winamp Vol", "winampVolEvent", 10, WinampVol/25.5
  1287. End Sub
  1288.  
  1289. Sub winampVolEvent(value,final)
  1290.   If (final = 1) Then winampMenu 
  1291.   WinampVol = value*2.55
  1292.   WinampCtrl.SetVolume = WinampVol
  1293. End Sub
  1294.  
  1295. '----------------- winamp volume control ------------------
  1296.  
  1297. '----------------------------- shuffle & repeat options ------------------------
  1298.  
  1299. Sub onAMWinampOptions
  1300.   am.Clear
  1301.   winampOptions
  1302. End Sub
  1303.  
  1304. Sub winampOptions
  1305.   am.ClearMenu
  1306.   am.Title = "Winamp Options"
  1307.  
  1308.   If (WinampCtrl.shuffle) Then
  1309.     am.AddItem " [*] shuffle", "onAMShuffleToggle"
  1310.   Else
  1311.     am.AddItem " [" + Space(SpaceOption) + "] shuffle", "onAMShuffleToggle"
  1312.   End If
  1313.  
  1314.   If (WinampCtrl.repeat) Then
  1315.     am.AddItem " [*] repeat", "onAMRepeatToggle"
  1316.   Else
  1317.     am.AddItem " [" + Space(SpaceOption) + "] repeat", "onAMRepeatToggle"
  1318.   End If
  1319.  
  1320.   If (SettingBackOption) Then am.AddItem MenuItemBack, "exitWinampOptions"
  1321.  
  1322.   am.Back = "onAMWinamp"
  1323.   am.Update
  1324. End Sub
  1325.  
  1326. Sub exitWinampOptions
  1327.   SelectItem = 8
  1328.   onAMWinamp
  1329. End Sub
  1330.  
  1331. Sub onAMShuffleToggle
  1332.   WinampCtrl.Shuffle = Not WinampCtrl.Shuffle
  1333.   winampOptions
  1334. End Sub
  1335.  
  1336. Sub onAMRepeatToggle
  1337.   WinampCtrl.Repeat = Not WinampCtrl.Repeat
  1338.   winampOptions
  1339. End Sub
  1340.  
  1341.  
  1342. '----------------- end options ---------------------------
  1343.  
  1344.  
  1345. '---------------------------- Main Volume Control -----------------------------
  1346.  
  1347. Sub onAMVolumeControl
  1348.   am.Clear
  1349.   volumeControlMenu
  1350. End Sub
  1351.  
  1352. Sub volumeControlMenu
  1353.   Dim VolStat
  1354.   VolStat = getVolumeStat
  1355.  
  1356.   am.ClearMenu                 'This will just clear the menu, last possition remainds
  1357.  
  1358.   am.Title = VolStat
  1359.  
  1360.   If VolStat = "Mute" Then
  1361.     am.AddItem "UnMute", "onVolMute"
  1362.   Else
  1363.     am.AddItem "Mute", "onVolMute"
  1364.     am.AddItem "Master Vol", "onMasterVol"
  1365.   End If
  1366.  
  1367.   am.AddItem "Show", "onVolShow"
  1368.   If (SettingBackOption) Then am.AddItem MenuItemBack, "onAMRoot"
  1369.  
  1370.   am.Back = "onAMRoot"
  1371.   am.Update
  1372. End Sub
  1373.  
  1374. Sub onMasterVol
  1375.   am.DlgPercent "Master Vol", "masterVolEvent", 10 , VolumeCtrl.Volume/10
  1376. End Sub
  1377.  
  1378.  
  1379. Sub masterVolEvent(value, final)
  1380.   VolumeCtrl.Volume = value
  1381.   If final = 1 Then volumeControlMenu
  1382. End Sub
  1383.  
  1384. Sub onVolShow
  1385.   VolumeCtrl.Show
  1386.   am.Update
  1387. End Sub
  1388.  
  1389. Sub onVolMute
  1390.   If VolumeCtrl.Mute = 1 Then
  1391.     VolumeCtrl.Mute = 0
  1392.   Else
  1393.     VolumeCtrl.Mute = 1
  1394.   End If
  1395.  
  1396.   volumeControlMenu
  1397. End Sub
  1398.  
  1399.  
  1400. Function getVolumeStat
  1401.   If VolumeCtrl.Mute = 1 Then
  1402.     getVolumeStat = "Mute"
  1403.   Else
  1404.     getVolumeStat = "Vol: " & VolumeCtrl.Volume & "%"
  1405.   End If
  1406. End Function
  1407.  
  1408. '---------------------------- Mouse Control -----------------------------
  1409.  
  1410. Sub onAMMouseControl
  1411.   am.Clear                 'This will just clear the menu, last possition remainds
  1412.  
  1413.   am.Title = "Mouse Control"
  1414.  
  1415.   If MouseControlActive = 0 Then
  1416.     am.AddItem "Activate", "mouseControlStart"
  1417.   Else
  1418.     am.AddItem "Deactivate", "mouseControlFinish"
  1419.   End If
  1420.  
  1421.   am.Back = "onAMRoot"
  1422.   am.Update
  1423. End Sub
  1424.  
  1425. Sub mouseControlStart
  1426.   fma.EnableKeyMonitor
  1427.   MouseControlActive = 1
  1428.  
  1429.   'Prevent OK button to close info box
  1430.   am.Back = ""
  1431.  
  1432.   'But show how to exit Mouse control mode
  1433.   am.DlgInformation "Mouse Control", "Use the Back button to Deactivate."
  1434. End Sub
  1435.  
  1436. Sub mouseControlFinish
  1437.   MouseCtrl.MouseStop
  1438.  
  1439.   fma.DisableKeyMonitor
  1440.   MouseControlActive = 0
  1441.  
  1442.   am.Back = "onAMRoot"
  1443. End Sub
  1444.  
  1445. Sub OnKeyPress(Key, State)
  1446.   If MouseControlActive = 1 Then
  1447.     If State = 0 Then
  1448.       MouseCtrl.MouseStop
  1449.     Else
  1450.       Select Case Key
  1451.         Case ":R"   mouseControlFinish
  1452.         Case ":e"   mouseControlFinish
  1453.  
  1454.         Case "<"    MouseCtrl.MouseMove("W")
  1455.         Case "^"    MouseCtrl.MouseMove("N")
  1456.         Case ">"    MouseCtrl.MouseMove("E")
  1457.         Case "v"    MouseCtrl.MouseMove("S")
  1458.  
  1459.         Case ":J"   MouseCtrl.MouseLeftClick
  1460.  
  1461.         Case "["    MouseCtrl.MouseLeftClick
  1462.         Case "]"    MouseCtrl.MouseRightClick
  1463.  
  1464.         Case "1"    MouseCtrl.MouseMove("NW")
  1465.         Case "2"    MouseCtrl.MouseMove("N")
  1466.         Case "3"    MouseCtrl.MouseMove("NE")
  1467.         Case "4"    MouseCtrl.MouseMove("W")
  1468.         Case "6"    MouseCtrl.MouseMove("E")
  1469.         Case "7"    MouseCtrl.MouseMove("SW")
  1470.         Case "8"    MouseCtrl.MouseMove("S")
  1471.         Case "9"    MouseCtrl.MouseMove("SE")
  1472.  
  1473.         Case "5"    MouseCtrl.MouseLeftClick
  1474.         Case "0"    MouseCtrl.MouseRightClick
  1475.  
  1476.         Case "u"    MouseCtrl.MouseWhlUp
  1477.         Case "d"    MouseCtrl.MouseWhlDown
  1478.       End Select
  1479.     End If
  1480.   End If
  1481. End Sub
  1482.  
  1483. '---------------------------- Hauppauge WinTV ---------------------------------
  1484.  
  1485. Sub onAMWinTV
  1486.   WinTVOpen = shell.AppActivate("WinTV32")
  1487.   am.Clear
  1488.   winTVMenu
  1489. End Sub
  1490.  
  1491.  
  1492. Sub winTVMenu
  1493.   am.ClearMenu
  1494.   am.Title = "WinTV"
  1495.  
  1496.   If (WinTVOpen) Then
  1497.     am.AddItem "Remote Mode", "onWinTVList"
  1498.     am.AddItem "Channel Up", "onWinTVChannelUp"
  1499.     am.AddItem "Channel Down", "onWinTVChannelDown"
  1500.     am.AddItem "Volume", "onWinTVVol"
  1501.     am.AddItem "Mute/UnMute", "onWinTVMute"
  1502.     am.AddItem "Fullscreen", "onWinTVFullscreen"
  1503.     am.AddItem "Freeze", "onWinTVFreeze"
  1504.     am.AddItem "Snapshot", "onWinTVSnapshot"
  1505.     am.AddItem "Close WinTV", "onWinTVClose"
  1506.   Else
  1507.     am.AddItem "Launch WinTV", "onWinTVLaunch"
  1508.   End If
  1509.   If (SettingBackOption) Then am.AddItem MenuItemBack, "onAMRoot"
  1510.  
  1511.   am.Back = "onAMRoot"
  1512.   am.Update
  1513. End Sub
  1514.  
  1515. Sub onWinTVLaunch
  1516.   shell.Run WinTVEXE
  1517.   WinTVOpen = TRUE
  1518.   winTVMenu
  1519. End Sub
  1520.  
  1521. Sub onWinTVClose
  1522.   If shell.AppActivate("WinTV32") Then shell.SendKeys("%{F4}")
  1523.   WinTVOpen = FALSE
  1524.   winTVMenu
  1525. End Sub
  1526.  
  1527.  
  1528.  
  1529. Sub onWinTVSnapshot
  1530.   If shell.AppActivate("WinTV32") Then shell.SendKeys("{ }")
  1531.   am.Update
  1532. End Sub
  1533.  
  1534. Sub onWinTVFreeze
  1535.   If shell.AppActivate("WinTV32") Then shell.SendKeys("^f")
  1536.   am.Update
  1537. End Sub
  1538.  
  1539. Sub onWinTVChannelDown
  1540.   If shell.AppActivate("WinTV32") Then shell.SendKeys("{-}")
  1541.   am.Update
  1542. End Sub
  1543.  
  1544. Sub onWinTVChannelUp
  1545.   If shell.AppActivate("WinTV32") Then shell.SendKeys("{+}")
  1546.   am.Update
  1547. End Sub
  1548.  
  1549. Sub onWinTVVol
  1550.   am.DlgPercent "Master Vol", "winTVVolEvent", 10 , VolumeCtrl.Volume/10
  1551. End Sub
  1552.  
  1553. Sub winTVVolEvent(value, final)
  1554.   VolumeCtrl.Volume = value
  1555.   If final = 1 Then winTVMenu
  1556. End Sub
  1557.  
  1558.  
  1559. Sub onWinTVFullscreen
  1560.   If shell.AppActivate("WinTV32") Then shell.SendKeys("^t")
  1561.   am.update
  1562. End Sub
  1563.  
  1564. Sub onWinTVMute
  1565.   If shell.AppActivate("WinTV32") Then shell.SendKeys("^m")
  1566.   am.update
  1567. End Sub
  1568.  
  1569. Sub onWinTVList
  1570.   Dim Button
  1571.   Button = "Button "
  1572.  
  1573.   am.Clear
  1574.   am.Title = "Remote Mode"
  1575.  
  1576.   am.AddItem Button & 1, "sendKey1"
  1577.   am.AddItem Button & 2, "sendKey2"
  1578.   am.AddItem Button & 3, "sendKey3"
  1579.   am.AddItem Button & 4, "sendKey4"
  1580.   am.AddItem Button & 5, "sendKey5"
  1581.   am.AddItem Button & 6, "sendKey6"
  1582.   am.AddItem Button & 7, "sendKey7"
  1583.   am.AddItem Button & 8, "sendKey8"
  1584.   am.AddItem Button & 9, "sendKey9"
  1585.   am.AddItem Button & 0, "sendKey0"
  1586.   am.AddItem center("Exit Mode"), "exitWinTVList"
  1587.  
  1588.   am.Back = "onAMWinTV"
  1589.   am.Update
  1590. End Sub
  1591.  
  1592. Sub exitWinTVList
  1593.   onAMWinTV
  1594. End Sub
  1595.  
  1596.  
  1597. Sub sendKey(b)
  1598.   If shell.AppActivate("WinTV32") Then shell.SendKeys b
  1599.   onWinTVList
  1600. End Sub
  1601.  
  1602. Sub sendKey1
  1603.   sendKey(1)
  1604. End Sub
  1605.  
  1606. Sub sendKey2
  1607.   sendKey(2)
  1608. End Sub
  1609.  
  1610. Sub sendKey3
  1611.   sendKey(3)
  1612. End Sub
  1613.  
  1614. Sub sendKey4
  1615.   sendKey(4)
  1616. End Sub
  1617.  
  1618. Sub sendKey5
  1619.   sendKey(5)
  1620. End Sub
  1621.  
  1622. Sub sendKey6
  1623.   sendKey(6)
  1624. End Sub
  1625.  
  1626. Sub sendKey7
  1627.   sendKey(7)
  1628. End Sub
  1629.  
  1630. Sub sendKey8
  1631.   sendKey(8)
  1632. End Sub
  1633.  
  1634. Sub sendKey9
  1635.   sendKey(9)
  1636. End Sub
  1637.  
  1638. Sub sendKey0
  1639.   sendKey(0)
  1640. End Sub
  1641.  
  1642.  
  1643. '--------------------------- MoreTV -----------------------------------------
  1644.  
  1645. Sub onAMMoreTV
  1646.   MoreTVOpen = shell.AppActivate("MoreTV")
  1647.   am.Clear
  1648.   MoreTVMenu
  1649. End Sub
  1650.         
  1651. Sub MoreTVMenu
  1652.   am.ClearMenu
  1653.   am.Title = "MoreTV"
  1654.   
  1655.   If (MoreTVOpen) Then
  1656.     am.AddItem "Remote Mode", "onMoreTVList"
  1657.     am.AddItem "Channel Up", "onMoreTVChannelUp"
  1658.     am.AddItem "Channel Down", "onMoreTVChannelDown"    
  1659.     am.AddItem "Volume", "onMoreTVVol"  
  1660.     am.AddItem "Mute/UnMute", "onMoreTVMute"   
  1661.     am.AddItem "Fullscreen", "onMoreTVFullscreen"       
  1662.     am.AddItem "Videotext", "onMoreTVVideotext"    
  1663.     am.AddItem "Close MoreTV", "onMoreTVClose"
  1664.   Else
  1665.     am.AddItem "Launch MoreTV", "onMoreTVLaunch"
  1666.   End If
  1667.   If (SettingBackOption) Then am.AddItem MenuItemBack, "onAMRoot"
  1668.  
  1669.   am.Back = "onAMRoot"
  1670.   am.Update
  1671. End Sub
  1672.  
  1673. Sub onMoreTVLaunch
  1674.   shell.Run MoreTVEXE
  1675.   MoreTVOpen = TRUE
  1676.   MoreTVMenu
  1677. End Sub
  1678.  
  1679. Sub onMoreTVClose
  1680.   If shell.AppActivate("MoreTV") Then shell.SendKeys "{F10}"
  1681.   MoreTVOpen = FALSE
  1682.   MoreTVMenu
  1683. End Sub
  1684.  
  1685.  
  1686. Sub onMoreTVChannelUp
  1687.   If shell.AppActivate("MoreTV") Then shell.SendKeys "{UP}"
  1688.   am.Selected = 2
  1689.   am.Update
  1690. End Sub
  1691.  
  1692. Sub onMoreTVChannelDown
  1693.   If shell.AppActivate("MoreTV") Then shell.SendKeys "{DOWN}"
  1694.   am.Update
  1695. End Sub
  1696.  
  1697. Sub onMoreTVMute
  1698.   If shell.AppActivate("MoreTV") Then shell.SendKeys "m"
  1699.   am.Update
  1700. End Sub
  1701.  
  1702. Sub onMoreTVVideotext
  1703.   If shell.AppActivate("MoreTV") Then shell.SendKeys "v"
  1704.   am.Update
  1705. End Sub
  1706.  
  1707.  
  1708. Sub onMoreTVVol
  1709.   am.DlgPercent "Master Vol", "moreTVVolEvent", 10 , VolumeCtrl.Volume/10
  1710. End Sub
  1711.  
  1712. Sub moreTVVolEvent(value, final)
  1713.   VolumeCtrl.Volume = value
  1714.   If final = 1 Then MoreTVMenu
  1715. End Sub
  1716.  
  1717. Sub onMoreTVFullscreen
  1718.   If shell.AppActivate("MoreTV") Then shell.SendKeys "{F9}"
  1719.   am.Update
  1720. End Sub
  1721.  
  1722. Sub onMoreTVList
  1723.   Dim Button
  1724.   Button = " Program "
  1725.  
  1726.   am.Clear
  1727.   am.Title = "Remote Mode"
  1728.  
  1729.   am.AddItem Button & 1, "sendKeyMTV1"
  1730.   am.AddItem Button & 2, "sendKeyMTV2"
  1731.   am.AddItem Button & 3, "sendKeyMTV3"
  1732.   am.AddItem Button & 4, "sendKeyMTV4"
  1733.   am.AddItem Button & 5, "sendKeyMTV5"
  1734.   am.AddItem Button & 6, "sendKeyMTV6"
  1735.   am.AddItem Button & 7, "sendKeyMTV7"
  1736.   am.AddItem Button & 8, "sendKeyMTV8"
  1737.   am.AddItem Button & 9, "sendKeyMTV9"
  1738.   am.AddItem Button & 0, "sendKeyMTV0"
  1739.   am.AddItem center("Exit Mode"), "exitMoreTVList"
  1740.  
  1741.   am.Back = "onAMMoreTVMenu"
  1742.   am.Update
  1743. End Sub
  1744.  
  1745. Sub exitMoreTVList
  1746.   onAMRoot
  1747. End Sub
  1748.  
  1749.  
  1750. Sub sendKeyMTV(b)
  1751.   If shell.AppActivate("MoreTV") Then shell.SendKeys b
  1752.   onMoreTVList
  1753. End Sub
  1754.  
  1755. Sub sendKeyMTV1
  1756.   sendKeyMTV(1)
  1757. End Sub
  1758.  
  1759. Sub sendKeyMTV2
  1760.   sendKeyMTV(2)
  1761. End Sub
  1762.  
  1763. Sub sendKeyMTV3
  1764.   sendKeyMTV(3)
  1765. End Sub
  1766.  
  1767. Sub sendKeyMTV4
  1768.   sendKeyMTV(4)
  1769. End Sub
  1770.  
  1771. Sub sendKeyMTV5
  1772.   sendKeyMTV(5)
  1773. End Sub
  1774.  
  1775. Sub sendKeyMTV6
  1776.   sendKeyMTV(6)
  1777. End Sub
  1778.  
  1779. Sub sendKeyMTV7
  1780.   sendKeyMTV(7)
  1781. End Sub
  1782.  
  1783. Sub sendKeyMTV8
  1784.   sendKeyMTV(8)
  1785. End Sub
  1786.  
  1787. Sub sendKeyMTV9
  1788.   sendKeyMTV(9)
  1789. End Sub
  1790.  
  1791. Sub sendKeyMTV0
  1792.   sendKey(0)
  1793. End Sub
  1794.  
  1795. '---------------------------- Media Player 9 Control --------------------------
  1796.  
  1797. Sub onAMMediaPlayer
  1798.   MediaPlayerOpen = shell.AppActivate("Windows Media Player")
  1799.   mediaPlayerMenu
  1800. End Sub
  1801.  
  1802. Sub mediaPlayerMenu
  1803.   am.Clear
  1804.   am.Title = "Media Player 9"
  1805.   
  1806.   If (MediaPlayerOpen) Then
  1807.     am.AddItem "Play/Pause", "onMP9PlayPause"
  1808.     am.AddItem "Stop", "onMP9Stop"
  1809.     am.AddItem "Prev Track", "onMP9Prev"
  1810.     am.AddItem "Next Track", "onMP9Next"
  1811.     am.AddItem "Fullscreen", "onMP9FullScreen"
  1812.     am.AddItem "Shuffle", "onMP9Shuffle"
  1813.     am.AddItem "Fast Forward", "onMP9FastForward"
  1814.     am.AddItem "Volume Up", "onMP9VolUp"
  1815.     am.AddItem "Volume Down", "onMP9VolDown"
  1816.     am.AddItem "Close MPlayer", "onMP9Close"
  1817.   Else
  1818.     am.AddItem "Launch MPlayer", "onMP9Launch"
  1819.   End If
  1820.   If (SettingBackOption) Then am.AddItem MenuItemBack, "onAMRoot"
  1821.  
  1822.   am.Back = "onAMRoot"
  1823.   am.Update
  1824. End Sub
  1825.  
  1826. Sub onMP9Launch
  1827.   shell.Run "wmplayer.exe"
  1828.   MediaPlayerOpen = TRUE
  1829.   mediaPlayerMenu
  1830. End Sub
  1831.  
  1832. Sub onMP9Close
  1833.   If shell.AppActivate("Windows Media Player") Then shell.SendKeys "%{F4}"
  1834.   MediaPlayerOpen = FALSE
  1835.   mediaPlayerMenu
  1836. End Sub
  1837.  
  1838. Sub onMP9PlayPause
  1839.   If shell.AppActivate("Windows Media Player") Then shell.SendKeys "^p"
  1840.   am.Update
  1841. End Sub
  1842.  
  1843. Sub onMP9Stop
  1844.   If shell.AppActivate("Windows Media Player") Then shell.SendKeys "^s"
  1845.   am.Selected = 1
  1846.   am.Update
  1847. End Sub
  1848.  
  1849. Sub onMP9Prev
  1850.   If shell.AppActivate("Windows Media Player")Then shell.SendKeys "^b"
  1851.   am.Update
  1852. End Sub
  1853.  
  1854. Sub onMP9Next
  1855.   If shell.AppActivate("Windows Media Player") Then shell.SendKeys "^f"
  1856.   am.Update
  1857. End Sub
  1858.  
  1859. Sub onMP9FullScreen
  1860.   If shell.AppActivate("Windows Media Player") Then shell.SendKeys "%~"
  1861.   am.Update
  1862. End Sub
  1863.  
  1864. Sub onMP9VolUp
  1865.   If shell.AppActivate("Windows Media Player") Then shell.SendKeys "^%{F10}"
  1866.   am.Update
  1867. End Sub
  1868.  
  1869. Sub onMP9VolDown
  1870.   If shell.AppActivate("Windows Media Player") Then shell.SendKeys "^%{F9}"
  1871.   am.Update
  1872. End Sub
  1873.  
  1874. Sub onMP9Shuffle
  1875.   If shell.AppActivate("Windows Media Player") Then shell.SendKeys "^h"
  1876.   am.Update
  1877. End Sub
  1878.  
  1879. Sub onMP9FastForward
  1880.   If shell.AppActivate("Windows Media Player") Then shell.SendKeys "^F"
  1881.   am.Update
  1882. End Sub
  1883.  
  1884.  
  1885. '--------------------------- BSPlayer -----------------------------------------
  1886.  
  1887. Sub onAMBSPlayer
  1888.   BSPlayerOpen = shell.AppActivate("BSPlayer")
  1889.   am.Clear
  1890.   BSPlayerMenu
  1891. End Sub
  1892.       
  1893. Sub BSPlayerMenu
  1894.   am.ClearMenu
  1895.   am.Title = "BSPlayer"
  1896.   
  1897.   If (BSPlayerOpen) Then
  1898.     am.AddItem "Play", "onBSPlayerPlay"
  1899.     am.AddItem "Pause", "onBSPlayerPause"
  1900.     am.AddItem "Stop", "onBSPlayerStop"
  1901.     am.AddItem "Prev", "onBSPlayerPrev"
  1902.     am.AddItem "Next", "onBSPlayerNext"
  1903.     am.AddItem "Fullscreen", "onBSPlayerFullscreen"
  1904.     am.AddItem "Sub On", "onBSPlayerSub"
  1905.     am.AddItem "Zoom", "onBSPlayerZoom"
  1906.     am.AddItem "Close BSPlayer", "onBSPlayerClose"
  1907.   Else
  1908.     am.AddItem "Launch BSPlayer", "onBSPlayerLaunch"
  1909.   End If
  1910.   If (SettingBackOption) Then am.AddItem MenuItemBack, "onAMRoot"
  1911.  
  1912.   am.Back = "onAMRoot"
  1913.   am.Update
  1914. End Sub
  1915.  
  1916. Sub onBSPlayerLaunch
  1917.   shell.Run BSPlayerEXE
  1918.   BSPlayerOpen = TRUE
  1919.   BSPlayerMenu
  1920. End Sub
  1921.  
  1922. Sub onBSPlayerClose
  1923.   If shell.AppActivate("BSPlayer") Then shell.SendKeys("%{F4}")
  1924.   BSPlayerOpen = FALSE
  1925.   BSPlayerMenu
  1926. End Sub
  1927.  
  1928.  
  1929.  
  1930. Sub onBSPlayerPlay
  1931.   If shell.AppActivate("BSPlayer") Then shell.SendKeys "x"
  1932.   am.Selected = 2
  1933.   am.Update
  1934. End Sub
  1935.  
  1936. Sub onBSPlayerPause
  1937.   If shell.AppActivate("BSPlayer") Then shell.SendKeys "c"
  1938.   am.Update
  1939. End Sub
  1940.  
  1941. Sub onBSPlayerStop
  1942.   If shell.AppActivate("BSPlayer") Then shell.SendKeys "v"
  1943.   am.Selected = 1
  1944.   am.Update
  1945. End Sub
  1946.  
  1947. Sub onBSPlayerPrev
  1948.   If shell.AppActivate("BSPlayer") Then shell.SendKeys "z"
  1949.   am.Update
  1950. End Sub
  1951.  
  1952. Sub onBSPlayerNext
  1953.   If shell.AppActivate("BSPlayer") Then shell.SendKeys "b"
  1954.   am.Update
  1955. End Sub
  1956.  
  1957. Sub onBSPlayerFullscreen
  1958.   If shell.AppActivate("BSPlayer") Then shell.SendKeys "f"
  1959.   am.Update
  1960. End Sub
  1961.  
  1962. Sub onBSPlayerSub
  1963.   If shell.AppActivate("BSPlayer") Then shell.SendKeys "s"
  1964.   am.Update
  1965. End Sub
  1966.  
  1967.  
  1968.  
  1969. '------------------ BSPlayer Zoom control -----------------
  1970.  
  1971. Sub onBSPlayerZoom            
  1972.   am.DlgPercent "Zoom control", "bsPlayerZoomEvent", 2, BSPlayerZoom
  1973. End Sub
  1974.  
  1975. Sub bsPlayerZoomEvent(value,final)
  1976.   If (final = 1) Then
  1977.     BSPlayerMenu
  1978.   ElseIf (value = 0) Then
  1979.     onBSPlayerZoom1
  1980.   ElseIf (value = 100) Then
  1981.     onBSPlayerZoom3
  1982.   Else
  1983.     onBSPlayerZoom2
  1984.   End If
  1985. End Sub
  1986.  
  1987.  
  1988. Sub onBSPlayerZoom1
  1989.   If shell.AppActivate("BSPlayer") Then shell.SendKeys "1"
  1990.   BSPlayerZoom = 0
  1991. End Sub
  1992.  
  1993. Sub onBSPlayerZoom2
  1994.   If shell.AppActivate("BSPlayer") Then shell.SendKeys "2"
  1995.   BSPlayerZoom = 1
  1996. End Sub
  1997.  
  1998. Sub onBSPlayerZoom3
  1999.   If shell.AppActivate("BSPlayer") Then shell.SendKeys "3"
  2000.   BSPlayerZoom = 2
  2001. End Sub
  2002.  
  2003. '----------------- BSPlayer Zoom control ------------------
  2004.  
  2005.  
  2006.  
  2007. '---------------------------- PowerDVD 5.0 Control -------------------------
  2008.  
  2009. Sub onAMPowerDVD
  2010.   PowerDVDOpen = shell.AppActivate("PowerDVD")
  2011.   powerDVDMenu
  2012. End Sub
  2013.  
  2014. Sub powerDVDMenu
  2015.   am.Clear
  2016.   am.Title = "PowerDVD [1/2]"
  2017.   
  2018.   If (PowerDVDOpen) Then
  2019.     am.AddItem "Play", "onPowerDVDPlay"
  2020.     am.AddItem "Pause", "onPowerDVDPause"
  2021.     am.AddItem "Stop", "onPowerDVDStop"
  2022.     am.AddItem "Prev Chapter", "onPowerDVDPrev"
  2023.     am.AddItem "Next Chapter", "onPowerDVDNext"
  2024.     am.AddItem "Step Backward", "onPowerDVDStepBwd"
  2025.     am.AddItem "Step Forward", "onPowerDVDStepFwd"
  2026.     am.AddItem "Capture Frame", "onPowerDVDCapture"
  2027.     am.AddItem "Audio Stream", "onPowerDVDAudio"
  2028.     am.AddItem MenuItemNext, "powerDVDMenu2"
  2029.   Else
  2030.     am.AddItem "Launch PowerDVD", "onPowerDVDLaunch"
  2031.     If (SettingBackOption) Then am.AddItem MenuItemBack, "onAMRoot"
  2032.   End If
  2033.  
  2034.   am.Back = "onAMRoot"
  2035.   am.Update
  2036. End Sub
  2037.  
  2038. Sub powerDVDMenu2
  2039.   am.Clear
  2040.   am.Title = "PowerDVD [2/2]"
  2041.   
  2042.   am.AddItem MenuItemPrev, "powerDVDMenu"
  2043.   am.AddItem "Subtitles", "onPowerDVDSubtitle"
  2044.   am.AddItem "Volume + 5", "onPowerDVDVolInc"
  2045.   am.AddItem "Volume - 5", "onPowerDVDVolDec"
  2046.   am.AddItem "Mute/UnMute", "onPowerDVDVolMute"
  2047.   am.AddItem "Full Screen", "onPowerDVDFull"
  2048.   am.AddItem "Set repeat", "onPowerDVDRepeat"
  2049.   am.AddItem "Set shuffle", "onPowerDVDShuffle"
  2050.   am.AddItem "Hide Controls", "onPowerDVDHide"
  2051.   am.AddItem "Close PowerDVD", "onPowerDVDClose"  
  2052.  
  2053.   If (SettingBackOption) Then am.AddItem MenuItemBack, "onAMRoot"
  2054.  
  2055.   am.Back = "powerDVDMenu"
  2056.   am.Update
  2057. End Sub
  2058.  
  2059.  
  2060. Sub onPowerDVDLaunch
  2061.   shell.Run PowerDVDEXE
  2062.   PowerDVDOpen = TRUE
  2063.   powerDVDMenu
  2064. End Sub
  2065.  
  2066. Sub onPowerDVDClose
  2067.   If shell.AppActivate("PowerDVD") Then shell.SendKeys "^x"
  2068.   PowerDVDOpen = FALSE
  2069.   powerDVDMenu
  2070. End Sub
  2071.  
  2072.  
  2073. Sub onPowerDVDPlay
  2074.   If shell.AppActivate("PowerDVD") Then shell.SendKeys "~"
  2075.   am.Selected = 2
  2076.   am.Update
  2077. End Sub
  2078.  
  2079. Sub onPowerDVDPause
  2080.   If shell.AppActivate("PowerDVD") Then shell.SendKeys "{ }"
  2081.   am.Update
  2082. End Sub
  2083.  
  2084. Sub onPowerDVDHide
  2085.   If shell.AppActivate("PowerDVD") Then shell.SendKeys "%{tab}"
  2086.   am.Update
  2087. End Sub
  2088.  
  2089. Sub onPowerDVDStop
  2090.   If shell.AppActivate("PowerDVD") Then shell.SendKeys "s"
  2091.   am.Selected = 1
  2092.   am.Update
  2093. End Sub
  2094.  
  2095. Sub onPowerDVDPrev
  2096.   If shell.AppActivate("PowerDVD") Then shell.SendKeys "p"
  2097.   am.Update
  2098. End Sub
  2099.  
  2100. Sub onPowerDVDNext
  2101.   If shell.AppActivate("PowerDVD") Then shell.SendKeys "n"
  2102.   am.Update
  2103. End Sub
  2104.  
  2105. Sub onPowerDVDSubtitle
  2106.   If shell.AppActivate("PowerDVD") Then shell.SendKeys "u"
  2107.   am.Update
  2108. End Sub
  2109.  
  2110. Sub onPowerDVDRepeat
  2111.   If shell.AppActivate("PowerDVD") Then shell.SendKeys "r"
  2112.   am.Update
  2113. End Sub
  2114.  
  2115. Sub onPowerDVDShuffle
  2116.   If shell.AppActivate("PowerDVD") Then shell.SendKeys "u"
  2117.   am.Update
  2118. End Sub
  2119.  
  2120. Sub onPowerDVDStepBwd
  2121.   If shell.AppActivate("PowerDVD") Then shell.SendKeys "^b"
  2122.   am.Update
  2123. End Sub
  2124.  
  2125. Sub onPowerDVDStepFwd
  2126.   If shell.AppActivate("PowerDVD") Then shell.SendKeys "t"
  2127.   am.Update
  2128. End Sub
  2129.  
  2130. Sub onPowerDVDCapture
  2131.   If shell.AppActivate("PowerDVD") Then shell.SendKeys "c"
  2132.   am.Update
  2133. End Sub
  2134.  
  2135. Sub onPowerDVDAudio
  2136.   If shell.AppActivate("PowerDVD") Then shell.SendKeys "h"
  2137.   am.Update
  2138. End Sub
  2139.  
  2140. Sub onPowerDVDVolInc
  2141.   If shell.AppActivate("PowerDVD") Then shell.SendKeys "{+}"
  2142.   am.Update
  2143. End Sub
  2144.  
  2145. Sub onPowerDVDVolDec
  2146.   If shell.AppActivate("PowerDVD") Then shell.SendKeys "{-}"
  2147.   am.Update
  2148. End Sub
  2149.  
  2150. Sub onPowerDVDVolMute
  2151.   If shell.AppActivate("PowerDVD") Then shell.SendKeys "q"
  2152.   am.Update
  2153. End Sub
  2154.  
  2155. Sub onPowerDVDFull
  2156.   If shell.AppActivate("PowerDVD") Then shell.SendKeys "z"
  2157.   am.Update
  2158. End Sub
  2159.  
  2160. Sub onPowerDVDMinimize
  2161.   If shell.AppActivate("PowerDVD") Then shell.SendKeys "^n"
  2162.   am.Update
  2163. End Sub
  2164.  
  2165.  
  2166. '---------------------------- PowerPoint Control ------------------------------
  2167.  
  2168. Sub onAMPowerPoint
  2169.   PPTOpen = shell.AppActivate("Microsoft Powerpoint")
  2170.   am.clear
  2171.   ShowPPMenu
  2172. End Sub
  2173.  
  2174. Sub ShowPPMenu
  2175.   am.ClearMenu
  2176.   am.Title = "Presentation"
  2177.  
  2178.   If (PPTOpen) Then
  2179.     am.AddItem "Start Show", "onPPStartShow"
  2180.     am.AddItem "Next Slide", "onPPNext"
  2181.     am.AddItem "Prev Slide", "onPPPrev"
  2182.     am.AddItem "Volume Up", "onPPVolUp"
  2183.     am.AddItem "Volume Down", "onPPVolUp"
  2184.     am.AddItem "Mute/UnMute", "onPPMute"
  2185.     am.AddItem "Switch", "onPPSwitch"
  2186.     am.AddItem "Black Screen", "onPPBlackScreen"
  2187.     am.AddItem "End Show", "onPPEndShow"
  2188.     am.AddItem "Exit PPT", "onPPClose"
  2189.   Else
  2190.     am.AddItem "Launch PPT", "onPPTLaunch"
  2191.     If (SettingBackOption) Then am.AddItem MenuItemBack, "onAMRoot"
  2192.   End If
  2193.  
  2194.   am.Back = "onAMRoot"
  2195.   am.Update
  2196. End Sub
  2197.  
  2198. Sub onPPTLaunch
  2199.   shell.Run PPTEXE
  2200.   PPTOpen = TRUE
  2201.   ShowPPMenu
  2202. End Sub
  2203.  
  2204. Sub onPPClose
  2205.   If shell.AppActivate("Microsoft PowerPoint") Then shell.SendKeys "%{F4}"
  2206.   PPTOpen = FALSE
  2207.   onAMRoot
  2208.   am.Update
  2209. End Sub
  2210.  
  2211. Sub onPPVolUp
  2212.   If shell.AppActivate("Microsoft PowerPoint") Then shell.SendKeys "^%{F10}"
  2213.   am.Update
  2214. End Sub
  2215.  
  2216. Sub onPPVolDown
  2217.   If shell.AppActivate("Microsoft PowerPoint") Then shell.SendKeys "^%{F9}"
  2218.   am.Update
  2219. End Sub
  2220.  
  2221. Sub onPPMute
  2222.   If shell.AppActivate("Microsoft PowerPoint") Then shell.SendKeys "^%{F12}"
  2223.   am.Update
  2224. End Sub
  2225.  
  2226. Sub onPPSwitch
  2227.   If shell.AppActivate("Microsoft PowerPoint") Then shell.SendKeys "%{tab}"
  2228.   am.Update
  2229. End Sub
  2230.  
  2231. Sub onPPBlackScreen
  2232.   If shell.AppActivate("Microsoft PowerPoint") Then shell.SendKeys "%cb"
  2233.   am.Update
  2234. End Sub
  2235.  
  2236. Sub onPPStartShow
  2237.   If shell.AppActivate("Microsoft PowerPoint") Then shell.SendKeys "{F5}"
  2238.   am.Update
  2239. End Sub
  2240.  
  2241. Sub onPPNext
  2242.   If shell.AppActivate("Microsoft PowerPoint") Then shell.SendKeys "n"
  2243.   am.Update
  2244. End Sub
  2245.  
  2246. Sub onPPPrev
  2247.   If shell.AppActivate("Microsoft PowerPoint") Then shell.SendKeys "p"
  2248.   am.Update
  2249. End Sub
  2250.  
  2251. Sub onPPEndShow
  2252.   If shell.AppActivate("Microsoft PowerPoint") Then shell.SendKeys "{ESC}"
  2253.   am.Update
  2254. End Sub
  2255.  
  2256.  
  2257.  
  2258. '---------------------------- Misc Control ------------------------------------
  2259.  
  2260. Sub onAMMisc
  2261.   am.Clear
  2262.   am.Title = "Misc"
  2263.   am.AddItem "Lock PC", "onAMLockWorkStation"
  2264.   am.AddItem "Disconnect ME", "onAMDisconnectME"
  2265.   am.AddItem "Shutdown Menu", "onAMshutdownMenu"
  2266.   If (SettingBackOption) Then am.AddItem MenuItemBack, "onAMRoot"
  2267.  
  2268.   am.Back = "onAMRoot"
  2269.   am.Update
  2270. End Sub
  2271.  
  2272. Sub onAMLockWorkStation
  2273.   shell.Run "Rundll32.exe user32.dll,LockWorkStation"
  2274.   am.Title = "PC Locked"
  2275.   am.Update
  2276. End Sub
  2277.  
  2278. Sub onAMDisconnectME
  2279.   Disconnect
  2280. End Sub
  2281.  
  2282. Sub onAMshutdownMenu
  2283.   am.Clear
  2284.   am.Title = "Shutdown PC"
  2285.   am.AddItem "Shutdown", "onAMshutdown"
  2286.   am.AddItem "Hibernate", "onAMhibernate"  
  2287.   am.AddItem "Reboot", "onAMreboot"
  2288.   If (ShutdownBool) Then am.AddItem "Cancel Shutdown", "onAMcancelShutdown"
  2289.  
  2290.   am.Back = "onAMMisc"
  2291.   am.Update
  2292. End Sub
  2293.  
  2294. Dim ShutdownBool
  2295. ShutdownBool = FALSE
  2296.  
  2297. Sub onAMshutdown
  2298.   ShutdownBool = TRUE
  2299.   am.Clear
  2300.   shell.Exec "shutdown -f -s -t 30"
  2301.   am.Title = "Shutdown.."
  2302.   am.AddItem center("Cancel reboot",""), "onAMcancelShutdown"
  2303.  
  2304.   am.Back = "onAMshutdownMenu"
  2305.   am.Update
  2306. End Sub
  2307.  
  2308. Sub onAMhibernate
  2309.   shell.Run "Rundll32.exe powrprof.dll,SetSuspendState"
  2310. End Sub
  2311.  
  2312. Sub onAMreboot
  2313.   ShutdownBool = TRUE
  2314.   am.Clear
  2315.   shell.Exec "shutdown -f -r -t 30"
  2316.   am.Title = "Reboot.."
  2317.   am.AddItem center("Cancel reboot",""), "onAMcancelShutdown"
  2318.  
  2319.   am.Back = "onAMshutdownMenu"
  2320.   am.Update
  2321. End Sub
  2322.  
  2323. Sub onAMcancelShutdown
  2324.   ShutdownBool = FALSE
  2325.  
  2326.   am.Clear
  2327.   shell.Exec "shutdown.exe -a"
  2328.   am.Title = "Canceled"
  2329.   am.AddItem center("Shutdown Menu",""), "onAMshutdownMenu"
  2330.  
  2331.   am.Back = "onAMshutdownMenu"
  2332.   am.Update
  2333. End Sub
  2334.  
  2335.  
  2336. '---------------------------------------------------------------------------------------------
  2337.  
  2338. Sub setRootMenuItems            'setting the menu items at the root according sequence in the array
  2339.   Dim i, id
  2340.   For i=1 To UBound(ArrID)        'ArrID(0) is empty and not used
  2341.     id = ArrID(i)
  2342.     If (id = iTunesID) Then
  2343.       am.AddItem "iTunes", "OnAMiTunes"
  2344.     ElseIf (id = WinTVID) Then
  2345.       am.AddItem "Hauppauge WinTV", "onAMWinTV"
  2346.     ElseIf (id = MoreTVID) Then
  2347.       am.AddItem "MoreTV", "onAMMoreTV"
  2348.     ElseIf (id = WinampID) Then
  2349.       am.AddItem "Winamp", "onAMWinamp"
  2350.     ElseIf (id = PowerDVDID) Then
  2351.       am.AddItem "PowerDVD 5.0", "onAMPowerDVD"
  2352.     ElseIf (id = WinDVD5ID) Then
  2353.       am.AddItem "WinDVD 5", "OnAMPDVD"
  2354.     ElseIf (id = WinDVD4ID) Then
  2355.       am.AddItem "WinDVD 4", "OnAMPDVD4"
  2356.     ElseIf (id = ZoomPlayerID) Then
  2357.       am.AddItem "ZoomPlayer", "OnAMZoomPlayer"
  2358.     ElseIf (id = BSPlayerID) Then
  2359.       am.AddItem "BSPlayer", "onAMBSPlayer"
  2360.     ElseIf (id = MediaPlayerID) Then
  2361.       am.AddItem "Media Player 9", "onAMMediaPlayer"
  2362.     ElseIf (id = VolumeControlID) Then
  2363.       am.AddItem "Volume Control", "onAMVolumeControl"
  2364.     ElseIf (id = MouseControlID) Then
  2365.       am.AddItem "Mouse Control", "onAMMouseControl"
  2366.     ElseIf (id = PowerPointID) Then
  2367.       am.AddItem "PowerPoint", "onAMPowerPoint"
  2368.     ElseIf (id = MiscControlID) Then
  2369.       am.AddItem "Misc Control", "onAMMisc"
  2370.     ElseIf (id = MsAgentID) Then
  2371.       am.AddItem "Ms Agent", "SpeechSay(SpeechText)"
  2372.     End If
  2373.   Next
  2374. End Sub
  2375.  
  2376. '---------------------------- user-settings menu ------------------------------
  2377. Function isSet(e)
  2378.   isSet = elementOf(e,ArrID)
  2379. End Function
  2380.  
  2381. Sub onAMsettings
  2382.   am.Clear
  2383.   settingsMenu
  2384. End Sub
  2385.  
  2386. Sub settingsMenu
  2387.   am.ClearMenu
  2388.   am.Title = "Settings [1/2]"
  2389.  
  2390.   If (isSet(iTunesID)) Then
  2391.     am.AddItem "[*] iTunes", "setiTunes"
  2392.   Else
  2393.     am.AddItem "[" + Space(SpaceOption) + "] iTunes", "setiTunes"
  2394.   End If
  2395.  
  2396.   If (isSet(WinTVID)) Then
  2397.     am.AddItem "[*] HP WinTV", "setWinTV"
  2398.   Else
  2399.     am.AddItem "[" + Space(SpaceOption) + "] HP WinTV", "setWinTV"
  2400.   End If
  2401.  
  2402.   If (isSet(MoreTVID)) Then
  2403.     am.AddItem "[*] MoreTV", "setMoreTV"
  2404.   Else
  2405.     am.AddItem "[" + Space(SpaceOption) +  "] MoreTV", "setMoreTV"
  2406.   End If
  2407.  
  2408.   If (isSet(WinampID)) Then
  2409.     am.AddItem "[*] Winamp", "setWinamp"
  2410.   Else
  2411.     am.AddItem "[" + Space(SpaceOption) + "] Winamp", "setWinamp"
  2412.   End If
  2413.  
  2414.   If (isSet(PowerDVDID)) Then
  2415.     am.AddItem "[*] PowerDVD 5.0", "setPowerDVD"
  2416.   Else
  2417.     am.AddItem "[" + Space(SpaceOption) + "] PowerDVD 5.0", "setPowerDVD"
  2418.   End If
  2419.  
  2420.   If (isSet(WinDVD5ID)) Then
  2421.     am.AddItem "[*] WinDVD 5", "setWinDVD5"
  2422.   Else
  2423.     am.AddItem "[" + Space(SpaceOption) + "] WinDVD 5", "setWinDVD5"
  2424.   End If
  2425.  
  2426.   If (isSet(WinDVD4ID)) Then
  2427.     am.AddItem "[*] WinDVD 4", "setWinDVD4"
  2428.   Else
  2429.     am.AddItem "[" + Space(SpaceOption) + "] WinDVD 4", "setWinDVD4"
  2430.   End If
  2431.  
  2432.   If (isSet(ZoomPlayerID)) Then
  2433.     am.AddItem "[*] ZoomPlayer", "setZoomPlayer"
  2434.   Else
  2435.     am.AddItem "[" + Space(SpaceOption) + "] ZoomPlayer", "setZoomPlayer"
  2436.   End If
  2437.  
  2438.   If (isSet(BSPlayerID)) Then
  2439.     am.AddItem "[*] BSPlayer", "setBSPlayer"
  2440.   Else
  2441.     am.AddItem "[" + Space(SpaceOption) + "] BSPlayer", "setBSPlayer"
  2442.   End If
  2443.  
  2444.   If (isSet(MediaPlayerID)) Then
  2445.     am.AddItem "[*] Media Player 9", "setMediaPlayer"
  2446.   Else
  2447.     am.AddItem "[" + Space(SpaceOption) + "] Media Player 9", "setMediaPlayer"
  2448.   End If
  2449.  
  2450.   If (isSet(PowerPointID)) Then
  2451.     am.AddItem "[*] PowerPoint", "setPowerPoint"
  2452.   Else
  2453.     am.AddItem "[" + Space(SpaceOption) + "] PowerPoint", "setPowerPoint"
  2454.   End If
  2455.  
  2456.   am.AddItem MenuItemNext, "onAMsettingsMenu2"
  2457.  
  2458.   am.Back = "exitSettings"
  2459.   am.Update
  2460. End Sub
  2461.  
  2462. Sub onAMsettingsMenu2
  2463.   am.clear
  2464.   settingsMenu2
  2465. End Sub
  2466.  
  2467. Sub settingsMenu2
  2468.   am.ClearMenu
  2469.   am.Title = "Settings [2/2]"
  2470.  
  2471.   am.AddItem MenuItemPrev, "onAMsettings"
  2472.  
  2473.   If (isSet(VolumeControlID)) Then
  2474.     am.AddItem "[*] Volume Control", "setVolumeControl"
  2475.   Else
  2476.     am.AddItem "[" + Space(SpaceOption) + "] Volume Control", "setVolumeControl"
  2477.   End If
  2478.  
  2479.   If (isSet(MouseControlID)) Then
  2480.     am.AddItem "[*] Mouse Control", "setMouseControl"
  2481.   Else
  2482.     am.AddItem "[" + Space(SpaceOption) + "] Mouse Control", "setMouseControl"
  2483.   End If
  2484.  
  2485.   If (isSet(MiscControlID)) Then
  2486.     am.AddItem "[*] Misc Control", "setMiscControl"
  2487.   Else
  2488.     am.AddItem "[" + Space(SpaceOption) + "] Misc Control", "setMiscControl"
  2489.   End If
  2490.  
  2491.   If (isSet(MsAgentID)) Then
  2492.     am.AddItem "[*] Ms Agent", "setMsAgent"
  2493.   Else
  2494.     am.AddItem "[" + Space(SpaceOption) + "] Ms Agent", "setMsAgent"
  2495.   End If
  2496.  
  2497.   If (SettingBackOption) Then
  2498.     am.AddItem "[*] Show Back", "setBackOption"
  2499.   Else
  2500.     am.AddItem "[" + Space(SpaceOption) + "] Show Back", "setBackOption"
  2501.   End If
  2502.  
  2503.   If (SaveSettingsBool) Then
  2504.     am.AddItem "[*] Save Settings", "setSaveSettings"
  2505.   Else
  2506.     am.AddItem "[" + Space(SpaceOption) + "] Save Settings", "setSaveSettings"
  2507.   End If
  2508.  
  2509.   'am.AddItem center2("-"), "am.update"
  2510.  
  2511.   am.AddItem center("[ Sort Menu ]"), "setOrderMenuItems"
  2512.  
  2513.   If (T610Enabled) Then
  2514.     am.AddItem Center("[*] T610 | [" + Space(SpaceOption) +"] T68i"), "setT610Enabled"
  2515.   Else
  2516.     am.AddItem Center("[" + Space(SpaceOption) + "]" + " T610 | [*] T68i"), "setT610Enabled"
  2517.   End If
  2518.  
  2519.   'am.AddItem center2("-"), "am.update"
  2520.  
  2521.   am.AddItem MenuItemExitMenu, "exitSettings"
  2522.  
  2523.   am.Back = "onAMsettings"
  2524.   am.Update
  2525. End Sub
  2526.  
  2527. Sub exitSettings
  2528.   If (SaveSettingsBool) Then
  2529.     saveSettings
  2530.   Else
  2531.     deleteSettings
  2532.   End If
  2533.   onAMRoot
  2534. End Sub
  2535.  
  2536.  
  2537. Sub setiTunes
  2538.   toggleOption(iTunesID)
  2539. End Sub
  2540.  
  2541. Sub setWinTV
  2542.   toggleOption(WinTVID)
  2543. End Sub
  2544.  
  2545. Sub setMoreTV
  2546.   toggleOption(MoreTVID)
  2547. End Sub
  2548.  
  2549. Sub setWinamp
  2550.   toggleOption(WinampID)
  2551. End Sub
  2552.  
  2553. Sub setPowerDVD
  2554.   toggleOption(PowerDVDID)
  2555. End Sub
  2556.  
  2557. Sub setWinDVD5
  2558.   toggleOption(WinDVD5ID)
  2559. End Sub
  2560.  
  2561. Sub setWinDVD4
  2562.   toggleOption(WinDVD4ID)
  2563. End Sub
  2564.  
  2565. Sub setZoomPlayer
  2566.   toggleOption(ZoomPlayerID)
  2567. End Sub
  2568.  
  2569. Sub setBSPlayer
  2570.   toggleOption(BSPlayerID)
  2571. End Sub
  2572.  
  2573. Sub setMediaPlayer
  2574.   toggleOption(MediaPlayerID)
  2575. End Sub  
  2576.  
  2577. Sub setVolumeControl
  2578.   toggleOption(VolumeControlID)
  2579. End Sub
  2580.  
  2581. Sub setMouseControl
  2582.   toggleOption(MouseControlID)
  2583. End Sub
  2584.  
  2585. Sub setPowerPoint
  2586.   toggleOption(PowerPointID)
  2587. End Sub
  2588.  
  2589. Sub setMiscControl
  2590.   toggleOption(MiscControlID)
  2591. End Sub
  2592.  
  2593. Sub setMsAgent
  2594.   toggleOption(MsAgentID)
  2595. End Sub
  2596.  
  2597. Sub setBackOption
  2598.   SettingBackOption = Not SettingBackOption
  2599.   settingsMenu2
  2600. End Sub
  2601.  
  2602. Sub setSaveSettings
  2603.   SaveSettingsBool = Not SaveSettingsBool
  2604.   settingsMenu2
  2605. End Sub
  2606.  
  2607. Sub setT610Enabled
  2608.   T610Enabled = Not T610Enabled
  2609.   selectPhone
  2610.   settingsMenu2
  2611. End Sub
  2612.  
  2613.  
  2614. Sub toggleOption(id)
  2615.   If (isSet(id)) Then
  2616.     removeElement(id)
  2617.   Else
  2618.     addElement(id)
  2619.   End If
  2620.   settingsMenu
  2621. End Sub
  2622.  
  2623. '------------------------ array functions-------------------------
  2624.  
  2625. Sub removeElement(id)
  2626.   Dim i
  2627.   For i=0 To UBound(ArrID)
  2628.     If (ArrID(i) = id) Then
  2629.         removeElementAt(i)
  2630.         Exit For
  2631.     End If
  2632.   Next
  2633. End Sub
  2634.  
  2635. Sub removeElementAt(p)
  2636.   Dim i, limit
  2637.   limit = UBound(ArrID)
  2638.   For i=p To limit-1
  2639.     ArrID(i)=ArrID(i+1)
  2640.   Next
  2641.   ReDim Preserve ArrID(limit-1)
  2642. End Sub
  2643.  
  2644. Sub addElement(id)
  2645.   Dim i, limit
  2646.   limit = UBound(ArrID)
  2647.   ReDim Preserve ArrID(limit+1)
  2648.   ArrID(limit+1) = id
  2649. End Sub
  2650.  
  2651.  
  2652. '------------------------------------ menu config ----------------------------------------
  2653.  
  2654.  
  2655. Sub setOrderMenuItems
  2656.   Dim i, id
  2657.   am.Clear
  2658.   am.Title = "Sort Menu"
  2659.  
  2660.   If(SelectItem>0) Then
  2661.     am.Selected = SelectItem 
  2662.     SelectItem = 0
  2663.   End If
  2664.  
  2665.   For i=0 To UBound(ArrID)
  2666.     id = ArrID(i)
  2667.     If (id = iTunesID) Then
  2668.       am.AddItem "iTunes", "moveUpiTunes"
  2669.     ElseIf (id = WinTVID) Then
  2670.       am.AddItem "Hauppauge WinTV", "moveUpWinTV"
  2671.     ElseIf (id = MoreTVID) Then
  2672.       am.AddItem "MoreTV", "moveUpMoreTV"
  2673.     ElseIf (id = WinampID) Then
  2674.       am.AddItem "Winamp", "moveUpWinamp"
  2675.     ElseIf (id = PowerDVDID) Then
  2676.       am.AddItem "PowerDVD 5.0", "moveUpPowerDVD"
  2677.     ElseIf (id = WinDVD5ID) Then
  2678.       am.AddItem "WinDVD 5", "moveUpWinDVD5"
  2679.     ElseIf (id = WinDVD4ID) Then
  2680.       am.AddItem "WinDVD 4", "moveUpWinDVD4"
  2681.     ElseIf (id = ZoomPlayerID) Then
  2682.       am.AddItem "ZoomPlayer", "moveUpZoomPlayer"
  2683.     ElseIf (id = BSPlayerID) Then
  2684.       am.AddItem "BSPlayer", "moveUpBSPlayer"
  2685.     ElseIf (id = MediaPlayerID) Then
  2686.       am.AddItem "Media Player 9", "moveUpMediaPlayer"
  2687.     ElseIf (id = VolumeControlID) Then
  2688.       am.AddItem "Volume Control", "moveUpVolumeControl"
  2689.     ElseIf (id = MouseControlID) Then
  2690.       am.AddItem "Mouse Control", "moveUpMouseControl"
  2691.     ElseIf (id = PowerPointID) Then
  2692.       am.AddItem "PowerPoint", "moveUpPowerPoint"
  2693.     ElseIf (id = MiscControlID) Then
  2694.       am.AddItem "Misc Control", "moveUpMiscControl"
  2695.     ElseIf (id = MSAgentID) Then
  2696.       am.AddItem "MS Agent", "moveUpMsAgent"
  2697.     End If
  2698.   Next
  2699.   
  2700.   am.Back = "settingsMenu2"
  2701.   am.Update
  2702. End Sub
  2703.  
  2704. Sub moveUpiTunes
  2705.   moveMenuItemUp(iTunesID)
  2706. End Sub
  2707.  
  2708. Sub moveUpWinTV
  2709.   moveMenuItemUp(WinTVID)
  2710. End Sub
  2711.  
  2712. Sub moveUpMoreTV
  2713.   moveMenuItemUp(MoreTVID)
  2714. End Sub
  2715.  
  2716. Sub moveUpWinamp
  2717.   moveMenuItemUp(WinampID)
  2718. End Sub
  2719.  
  2720. Sub moveUpPowerDVD
  2721.   moveMenuItemUp(PowerDVDID)
  2722. End Sub
  2723.  
  2724. Sub moveUpWinDVD5
  2725.   moveMenuItemUp(WinDVD5ID)
  2726. End Sub
  2727.  
  2728. Sub moveUpWinDVD4
  2729.   moveMenuItemUp(WinDVD4ID)
  2730. End Sub
  2731.  
  2732. Sub moveUpZoomPlayer
  2733.   moveMenuItemUp(ZoomPlayerID)
  2734. End Sub
  2735.  
  2736. Sub moveUpBSPlayer
  2737.   moveMenuItemUp(BSPlayerID)
  2738. End Sub
  2739.  
  2740. Sub moveUpMediaPlayer
  2741.   moveMenuItemUp(MediaPlayerID)
  2742. End Sub
  2743.  
  2744. Sub moveUpVolumeControl
  2745.   moveMenuItemUp(VolumeControlID)
  2746. End Sub
  2747.  
  2748. Sub moveUpMouseControl
  2749.   moveMenuItemUp(MouseControlID)
  2750. End Sub
  2751.  
  2752. Sub moveUpPowerPoint
  2753.   moveMenuItemUp(PowerPointID)
  2754. End Sub
  2755.  
  2756. Sub moveUpMiscControl
  2757.   moveMenuItemUp(MiscControlID)
  2758. End Sub
  2759.  
  2760. Sub moveUpMsAgent
  2761.   moveMenuItemUp(MsAgentID)
  2762. End Sub
  2763.  
  2764. Sub moveMenuItemUp(id)
  2765.   Dim i, limit, temp
  2766.   limit = UBound(ArrID)
  2767.   For i=1 to limit
  2768.     If(id = ArrID(i)) Then
  2769.       If (i=1) Then
  2770.         temp = ArrID(1)
  2771.         removeElementAt(1)
  2772.         addElement(temp)
  2773.         SelectItem = limit
  2774.       Else
  2775.         temp = ArrID(i-1)
  2776.         ArrID(i-1) = ArrID(i)
  2777.         ArrID(i) = temp
  2778.         SelectItem = i-1
  2779.       End If
  2780.       Exit For
  2781.     End If
  2782.   Next
  2783.   setOrderMenuItems
  2784. End Sub
  2785.  
  2786.  
  2787.  
  2788. '---------------------------- read and save file functions --------------------
  2789.  
  2790. Sub saveSettings
  2791.   Set File = Fso.OpenTextFile(SettingsFile, ForWriting, True)
  2792.   File.WriteLine ScriptVersion
  2793.   File.WriteLine T610Enabled
  2794.  
  2795.   File.WriteLine SettingBackOption
  2796.  
  2797.   For each id in ArrID
  2798.     File.WriteLine id
  2799.   Next
  2800.  
  2801.   File.WriteLine "EOF"
  2802.   
  2803.   File.Close
  2804. End Sub
  2805.  
  2806. Sub deleteSettings
  2807.     If (Fso.FileExists(SettingsFile)) Then
  2808.       Set File = Fso.GetFile(SettingsFile)
  2809.       File.Delete
  2810.     End If
  2811. End Sub
  2812.  
  2813. Sub readSettings
  2814.   Dim i, temp, dummy
  2815.   If (Fso.FileExists(SettingsFile)) Then
  2816.     Set File = Fso.OpenTextFile(SettingsFile, ForReading)
  2817.  
  2818.     If(ScriptVersion <> File.ReadLine) Then    '1st line in settings file
  2819.       File.Close
  2820.       deleteSettings
  2821.     Else
  2822.       SaveSettingsBool = True
  2823.       T610Enabled = File.ReadLine
  2824.  
  2825.       SettingBackOption = File.ReadLine
  2826.  
  2827.       Erase ArrID
  2828.       ReDim ArrID(0)
  2829.       dummy = File.ReadLine    'first element of array is empty
  2830.       temp = File.ReadLine
  2831.       If (temp <> "EOF") Then
  2832.         While (temp <> "EOF")
  2833.           addElement(temp)
  2834.           temp = File.ReadLine
  2835.         Wend 
  2836.       End If
  2837.       File.Close
  2838.       
  2839.       selectPhone
  2840.     End If
  2841.   End If
  2842. End Sub
  2843.  
  2844.  
  2845. '---------------------------- End Active Menu ---------------------------------
  2846.  
  2847. '---------------------------- Start Webcam ------------------------------------
  2848.  
  2849. Sub OnTakeSinglePicture
  2850.  Dim cmd
  2851.  If fma.Connected = 1 Then
  2852.    TakePicture
  2853.  Else
  2854.    fma.Debug "Webcam - Not Connected to Phone"
  2855.  End If
  2856. End Sub
  2857.  
  2858. Sub OnStartWebcam
  2859.  Dim cmd
  2860.  If fma.Connected = 1 Then
  2861.    ' check if new can take picture on every 2 seconds
  2862.    ' (wait for previous call to finish)
  2863.    fma.AddTimer 2000, "OnTakeSinglePicture"
  2864.  Else
  2865.    MsgBox "Webcam - Not Connected to Phone"
  2866.  End If
  2867. End Sub
  2868.  
  2869. Sub OnStopWebcam
  2870.  fma.DeleteTimer "OnTakeSinglePicture"
  2871. End Sub
  2872.  
  2873. Sub TakePicture
  2874.  Dim cmd
  2875.  If fma.Connected = 1 Then
  2876.    fma.Debug "Webcam - Picturing..."
  2877.  
  2878.    cmd = "at+clck=""CS"",0" ' Unlock phone
  2879.    Transmit cmd
  2880.    fma.Sleep (1000)
  2881.    cmd = "AT+CKPD="":C""" ' Enter camera mode
  2882.    Transmit cmd
  2883.    fma.Sleep (1000)
  2884.    cmd = "AT+CKPD="":C""" ' Take picture
  2885.    Transmit cmd
  2886.  
  2887.    ' create filename here to get the (more or less) exact time & date of the picture
  2888.    outputfile = outputdirectory & Year(Date) & "-" & LeadZero(Month(Date)) & "-" & LeadZero(Day(Date)) & "_" & LeadZero(Hour (time)) & "-" & LeadZero(Minute (time)) & "-" & LeadZero(Second (time)) & ".jpg"
  2889.  
  2890.    fma.Sleep (9000)
  2891.    cmd = "AT+CKPD="":C""" ' Save picture
  2892.    Transmit cmd
  2893.    fma.Sleep (5000)
  2894.    cmd = "AT+CKPD="":R""" ' Return to main menu
  2895.    Transmit cmd
  2896.    fma.Sleep (1000)
  2897.    cmd = "AT+CKPD="":R"""
  2898.    Transmit cmd
  2899.  
  2900.    fma.ObexCut outputfile, filename
  2901.    fma.Debug "Webcam - Picture taked"
  2902.  End If
  2903. End Sub
  2904.  
  2905. Function delay(N)   ' delay N seconds
  2906.    Dim StartTime, EndTime
  2907.    StartTime = Timer
  2908.    EndTime = Timer + N
  2909.    Do
  2910.    Loop while EndTime > Timer
  2911. End Function
  2912.  
  2913. Function LeadZero(ByVal N)
  2914.    if (N>=0) and (N<10) then LeadZero = "0" & N else LeadZero = "" & N
  2915. End Function
  2916.  
  2917. '---------------------------- End Webcam --------------------------------------
  2918.  
  2919. '---------------------------- Begin WinDVD 5 ----------------------------------
  2920. ' TODO: Split ni several submenus!!!
  2921.  
  2922. sub OnAMPDVD
  2923. ' am.Selected = 1
  2924. ' am.Update
  2925.   am.Clear
  2926.   am.Title = "WinDVD"
  2927.   am.AddItem "Play/Select", "OnAMPDVDPlay"
  2928.   am.AddItem "Pause", "OnAMPDVDPause"
  2929.   am.AddItem "Stop", "OnAMPDVDStop"
  2930.   am.AddItem "Prev Chapter", "OnAMPDVDPrev"
  2931.   am.AddItem "Next Chapter", "OnAMPDVDNext"
  2932.   am.AddItem "Go Up", "OnAMPDVDGoUp"
  2933.   am.AddItem "Go Down", "OnAMPDVDGoDown"
  2934. ' am.AddItem "Step Forward", "OnAMPDVDStepFwd"
  2935.   am.AddItem "Subtitles", "OnAMPDVDSubtitle"
  2936.   am.AddItem "Volume Up", "OnAMPDVDVolInc"
  2937.   am.AddItem "Volume Down", "OnAMPDVDVolDec"
  2938.   am.AddItem "Mute/UnMute", "OnAMPDVDVolMute"
  2939.   am.AddItem "Full Screen", "OnAMPDVDFull"
  2940.   am.AddItem "Speed Down", "OnAMPDVDSpeedDown"
  2941.   am.AddItem "Speed Up", "OnAMPDVDSpeedUp"
  2942. ' am.AddItem "Step", "OnAMPDVDStep"
  2943. ' am.AddItem "Audio Lang", "OnAMPDVDAudio"
  2944. ' am.AddItem "Chapter", "OnAMPDVDChapter"
  2945.   am.AddItem "Fast Forward", "OnAMPDVDFastForward"
  2946.   am.AddItem "Rewind", "OnAMPDVDRewind"
  2947. ' am.AddItem "Playlist", "OnAMPDVDPlayList"
  2948.   am.AddItem "Main Menu", "OnAMPDVDMainMenu"
  2949.   am.AddItem "Launch", "OnAMPDVDLaunch"
  2950.   am.AddItem "Close", "OnAMPDVDClose"
  2951.   am.Back = "onAMRoot"
  2952.   am.Update
  2953. ' OnAMPDVDLaunch
  2954. end sub
  2955.  
  2956. sub OnAMPDVDPlay
  2957.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "~"
  2958.   am.Update
  2959. end sub
  2960.  
  2961. sub OnAMPDVDPause
  2962.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "{ }"
  2963.   am.Update
  2964. end sub
  2965.  
  2966. sub OnAMPDVDAudio
  2967.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "a"
  2968.   am.Update
  2969. end sub
  2970.  
  2971. sub OnAMPDVDChapter
  2972.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "c"
  2973.   am.Update
  2974. end sub
  2975.  
  2976. sub OnAMPDVDFastForward
  2977.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "f"
  2978.   am.Update
  2979. end sub
  2980.  
  2981. sub OnAMPDVDGoDown
  2982.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "{DOWN}"
  2983.   am.Update
  2984. end sub
  2985.  
  2986. sub OnAMPDVDMainMenu
  2987.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "^m"
  2988.   am.Update
  2989. end sub
  2990.  
  2991. sub OnAMPDVDSpeedDown
  2992.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "^{LEFT}"
  2993.   am.Update
  2994. end sub
  2995.  
  2996. sub OnAMPDVDSpeedUp
  2997.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "^{RIGHT}"
  2998.   am.Update
  2999. end sub
  3000.  
  3001. sub OnAMPDVDPlayList
  3002.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "l"
  3003.   am.Update
  3004. end sub
  3005.  
  3006. sub OnAMPDVDRewind
  3007.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "r"
  3008.   am.Update
  3009. end sub
  3010.  
  3011. sub OnAMPDVDStep
  3012.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "n"
  3013.   am.Update
  3014. end sub
  3015.  
  3016. sub OnAMPDVDStop
  3017.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "{END}"
  3018.   am.Update
  3019. end sub
  3020.  
  3021. sub OnAMPDVDPrev
  3022.   if shell.AppActivate("InterVideo WinDVD")then shell.SendKeys "{PGUP}"
  3023.   am.Update
  3024. end sub
  3025.  
  3026. sub OnAMPDVDNext
  3027.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "{PGDN}"
  3028.   am.Update
  3029. end sub
  3030.  
  3031. sub OnAMPDVDSubtitle
  3032.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "s"
  3033.   am.Update
  3034. end sub
  3035.  
  3036. sub OnAMPDVDGoUp
  3037.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "{UP}"
  3038.   am.Update
  3039. end sub
  3040.  
  3041. sub OnAMPDVDStepFwd
  3042.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "n"
  3043.   am.Update
  3044. end sub
  3045.  
  3046. sub OnAMPDVDVolInc
  3047.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "+{UP}"
  3048.   am.Update
  3049. end sub
  3050.  
  3051. sub OnAMPDVDVolDec
  3052.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "+{DOWN}"
  3053.   am.Update
  3054. end sub
  3055.  
  3056. sub OnAMPDVDVolMute
  3057.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "m"
  3058.   am.Update
  3059. end sub
  3060.  
  3061. sub OnAMPDVDFull
  3062.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "z"
  3063.   am.Update
  3064. end sub
  3065.  
  3066. sub OnAMPDVDLaunch
  3067.   shell.Run "C:\PROGRA~1\INTERV~1\WINDVD\WINDVD.EXE"
  3068.   am.Selected = 1
  3069.   am.Update
  3070. end sub
  3071.  
  3072. sub OnAMPDVDClose
  3073.   if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys "x"
  3074.   am.Selected = 6
  3075.   am.Update
  3076. end sub
  3077.  
  3078. '----------------------------- End WinDVD 5 ------------------------------------
  3079.  
  3080. '---------------------------- Begin WinDVD 4 -----------------------------------
  3081. 'These Key mappings are those used by WinDVD 4 rather than WinDVD 5
  3082. 'Created 15/08/2004 RWT V1.0 
  3083. ' TODO: Split in several submenus!!!
  3084.  
  3085. sub OnAMPDVD4
  3086.   am.Clear
  3087.   am.Title = "WinDVD 4"
  3088.   am.AddItem "Launch", "OnAMPDVDLaunch4"
  3089.   am.AddItem "Play/Select", "OnAMPDVDPlay4"
  3090.   am.AddItem "Fast Forward", "OnAMPDVDFastForward4"
  3091.   am.AddItem "Pause", "OnAMPDVDPause4"
  3092.   am.AddItem "Rewind", "OnAMPDVDRewind4"
  3093.   am.AddItem "Stop", "OnAMPDVDStop4"
  3094.   am.AddItem "Next Chapter", "OnAMPDVDNext4"
  3095.   am.AddItem "Prev Chapter", "OnAMPDVDPrev4"
  3096.   am.AddItem "Volume Up", "OnAMPDVDVolInc4"
  3097.   am.AddItem "Volume Down", "OnAMPDVDVolDec4"
  3098.   am.AddItem "Mute/UnMute", "OnAMPDVDVolMute4"
  3099.   am.AddItem "Subtitles", "OnAMPDVDSubtitle4"
  3100.   am.AddItem "Main Menu", "OnAMPDVDMainMenu4"
  3101.   am.AddItem "Full Screen", "OnAMPDVDFull4"
  3102.   am.addItem "Up","OnAMPDVDGoUp4"
  3103.   am.addItem "Down","OnAMPDVDGoDown4"
  3104.   am.addItem "Select","OnAMPDVDSelect4"
  3105.   am.AddItem "Close", "OnAMPDVDClose4"
  3106.   am.Back = "onAMRoot"
  3107.   am.Update
  3108. end sub
  3109.  
  3110. sub OnAMPDVDPlay4
  3111.   if shell.AppActivate("InterVideo WinDVD 4") then shell.SendKeys "~"
  3112.   am.Update
  3113. end sub
  3114.  
  3115. sub OnAMPDVDFastForward4
  3116.   if shell.AppActivate("InterVideo WinDVD 4") then shell.SendKeys "f"
  3117.   am.Update
  3118. end sub
  3119.  
  3120. sub OnAMPDVDPause4
  3121.   if shell.AppActivate("InterVideo WinDVD 4") then shell.SendKeys "{ }"
  3122.   am.Update
  3123. end sub
  3124.  
  3125. sub OnAMPDVDRewind4
  3126.   if shell.AppActivate("InterVideo WinDVD 4") then shell.SendKeys "r"
  3127.   am.Update
  3128. end sub
  3129.  
  3130. sub OnAMPDVDStop4
  3131.   if shell.AppActivate("InterVideo WinDVD 4") then shell.SendKeys "{END}"
  3132.   am.Update
  3133. end sub
  3134.  
  3135. sub OnAMPDVDNext4
  3136.   if shell.AppActivate("InterVideo WinDVD 4") then shell.SendKeys "{PGDN}"
  3137.   am.Update
  3138. end sub
  3139.  
  3140. sub OnAMPDVDPrev4
  3141.   if shell.AppActivate("InterVideo WinDVD 4")then shell.SendKeys "{PGUP}"
  3142.   am.Update
  3143. end sub
  3144.  
  3145. sub OnAMPDVDGoDown4
  3146.   if shell.AppActivate("InterVideo WinDVD 4") then shell.SendKeys "{DOWN}"
  3147.   am.Update
  3148. end sub
  3149.  
  3150. sub OnAMPDVDGoUp4
  3151.   if shell.AppActivate("InterVideo WinDVD 4") then shell.SendKeys "{UP}"
  3152.   am.Update
  3153. end sub
  3154.  
  3155. sub OnAMPDVDMainMenu4
  3156.   if shell.AppActivate("InterVideo WinDVD 4") then shell.SendKeys "^m"
  3157.   am.Update
  3158. end sub
  3159.  
  3160. sub OnAMPDVDSubtitle4
  3161.   if shell.AppActivate("InterVideo WinDVD 4") then shell.SendKeys "s"
  3162.   am.Update
  3163. end sub
  3164.  
  3165. sub OnAMPDVDSelect4
  3166.   if shell.AppActivate("InterVideo WinDVD 4") then shell.SendKeys "{ENTER}"
  3167.   am.Update
  3168. end sub
  3169.  
  3170. sub OnAMPDVDGoUp4
  3171.   if shell.AppActivate("InterVideo WinDVD 4") then shell.SendKeys "{UP}"
  3172.   am.Update
  3173. end sub
  3174.  
  3175.  
  3176. sub OnAMPDVDVolInc4
  3177.   if shell.AppActivate("InterVideo WinDVD 4") then shell.SendKeys "+{UP}"
  3178.   am.Update
  3179. end sub
  3180.  
  3181. sub OnAMPDVDVolDec4
  3182.   if shell.AppActivate("InterVideo WinDVD 4") then shell.SendKeys "+{DOWN}"
  3183.   am.Update
  3184. end sub
  3185.  
  3186. sub OnAMPDVDVolMute4
  3187.   if shell.AppActivate("InterVideo WinDVD 4") then shell.SendKeys "m"
  3188.   am.Update
  3189. end sub
  3190.  
  3191. sub OnAMPDVDFull4
  3192.   if shell.AppActivate("InterVideo WinDVD 4") then shell.SendKeys "z"
  3193.   am.Update
  3194. end sub
  3195.  
  3196. sub OnAMPDVDLaunch4
  3197.   shell.Run "C:\PROGRA~1\INTERV~1\WINDVD4\WINDVD.EXE"
  3198.   am.Selected = 1
  3199.   am.Update
  3200. end sub
  3201.  
  3202. sub OnAMPDVDClose4
  3203.   if shell.AppActivate("InterVideo WinDVD 4") then shell.SendKeys "x"
  3204.   am.Selected = 6
  3205.   am.Update
  3206. end sub
  3207. '------------------------------ End WinDVD 4-----------------------------------
  3208.  
  3209.  
  3210. '----------------------------- Begin iTunes -----------------------------------
  3211.  
  3212. sub OnAMiTunes
  3213.   am.Clear
  3214.   am.Title = "iTunes"
  3215.   am.AddItem "Play/Pause", "OnAMiTPlayPause"
  3216.   am.AddItem "Stop", "OnAMiTStop"
  3217.   am.AddItem "Prev Track", "OnAMiTPrev"
  3218.   am.AddItem "Next Track", "OnAMiTNext"
  3219.   am.AddItem "Vizualizer", "OnAMiTFullScreen"
  3220.   am.AddItem "Launch", "OnAMiTLaunch"
  3221.   am.AddItem "Close", "OnAMiTClose"
  3222.   am.Back = "onAMRoot"
  3223.   am.Update
  3224. end sub
  3225.  
  3226. sub OnAMiTPlayPause
  3227.   if shell.AppActivate("iTunes") then shell.SendKeys " "
  3228.   am.Update
  3229. end sub
  3230.  
  3231. sub OnAMiTStop
  3232.   if shell.AppActivate("iTunes") then shell.SendKeys " "
  3233.   am.Update
  3234. end sub
  3235.  
  3236. sub OnAMiTPrev
  3237.   if shell.AppActivate("iTunes")then shell.SendKeys "^{LEFT}"
  3238.   am.Update
  3239. end sub
  3240.  
  3241. sub OnAMiTNext
  3242.   if shell.AppActivate("iTunes") then shell.SendKeys "^{RIGHT}"
  3243.   am.Update
  3244. end sub
  3245.  
  3246. sub OnAMiTFullScreen
  3247.   if shell.AppActivate("iTunes") then shell.SendKeys "^t"
  3248. am.Update
  3249. end sub
  3250.  
  3251. sub OnAMiTLaunch
  3252.   'Specify correct path to the executable here:
  3253.   shell.Run "iTunes.exe"
  3254.   am.Selected = 1
  3255.   am.Update
  3256. end sub
  3257.  
  3258. sub OnAMiTClose
  3259.   if shell.AppActivate("iTunes") then shell.SendKeys "%{F4}"
  3260.   am.Selected = 6
  3261.   am.Update
  3262. end sub
  3263.  
  3264. '------------------------------ End iTunes ------------------------------------
  3265.  
  3266. '------------------------ Begin MS Agent Speech ---------------------------------
  3267. ' SpeechSay by skyw33
  3268. ' Here's a function for having MS Agent speak anything you give it 
  3269. ' Just specify where your agent character file is.
  3270. '
  3271. ' *** THIS IS WORK IN PROGRESS!!! ***
  3272. '
  3273. ' I posted the MS Agent Script a while back. The only way I've gotten it to work is
  3274. ' to "run" a separate, stand-alone script from within the fma script that contains 
  3275. ' the instructions to launch Agent. So far, the things I've found that run in stand-alone 
  3276. ' mode but don't run from within fma are this and the wscript.sleep function.
  3277.  
  3278. Sub SpeechSay(SpeechText)
  3279.   On Error Resume Next
  3280.   Set AgentControl = CreateObject("Agent.Control.1")
  3281.   If IsObject(AgentControl) Then
  3282.     AgentControl.Connected = True
  3283.     Dim floyd
  3284.     On Error Resume Next
  3285.     'edit here - specify where your agent character file is
  3286.     AgentControl.Characters.Load "floyd", "C:\WINDOWS\MSAGENT\CHARS\floyd.ACS"
  3287.     Set floyd = AgentControl.Characters ("floyd")
  3288.     floyd.Get "state", "Showing"
  3289.     floyd.Get "state", "Speaking"
  3290.     floyd.MoveTo 200, 200
  3291.     floyd.Show
  3292.     floyd.Get "state", "Moving"
  3293.     floyd.Speak (SpeechText)
  3294.     floyd.Hide
  3295.     'unload objects
  3296.     Set floyd = nothing
  3297.     Set AgentControl = nothing
  3298.   End If
  3299. End Sub
  3300.  
  3301. '--------------------------- End MS Agent Speech ---------------------------------
  3302.  
  3303.  
  3304. '----------------------------- Locate Phone -----------------------------------
  3305.  
  3306. Sub OnLocatePhone
  3307.   Dim cmd
  3308.   If fma.Connected = 1 Then
  3309.     LocatePhoneNow
  3310.   Else
  3311.     fma.Debug "Locate cannot work - Not Connected to Phone"
  3312.   End If
  3313. End Sub
  3314.  
  3315. Sub LocatePhoneNow
  3316.   Dim cmd
  3317.   If fma.Connected = 1 Then
  3318.   fma.Debug "Locating phone..."
  3319.  
  3320.   cmd = "AT+CKPD="":R""" ' Return to main menu (just in case)
  3321.   Transmit cmd
  3322.   cmd = "AT+CKPD="":R"""
  3323.   Transmit cmd
  3324.   cmd = "AT+CKPD="":R"""
  3325.   Transmit cmd
  3326.   cmd = "at+clck=""CS"",0" ' Unlock phone
  3327.   Transmit cmd
  3328.   cmd = "AT+CKPD="":J""" ' Open menu
  3329.   Transmit cmd
  3330.   cmd = "AT+CKPD=""7""" ' Open Pictures & Sounds submenu
  3331.   Transmit cmd
  3332.   cmd = "AT+CKPD=""3""" ' Open Sounds menu
  3333.   Transmit cmd
  3334.   cmd = "AT+CKPD=""^""" ' Go to first sound at bottom
  3335.   Transmit cmd
  3336.   cmd = "AT+CKPD="":J""" ' Play sound
  3337.   Transmit cmd
  3338.   fma.Sleep (15000) ' Change this for play length (default 15000 - 15secs)
  3339.   cmd = "AT+CKPD="":R""" ' Return to main menu
  3340.   Transmit cmd
  3341.   cmd = "AT+CKPD="":R"""
  3342.   Transmit cmd
  3343.   cmd = "AT+CKPD="":R"""
  3344.   Transmit cmd
  3345.  
  3346.   fma.Debug "Phone located"
  3347.   End If
  3348. End Sub
  3349.  
  3350. '--------------------------- End Locate Phone ---------------------------------
  3351.  
  3352. '---------------------------- Begin ZoomPlayer ------------------------------------
  3353.  
  3354. Sub OnAMZoomPlayer
  3355.   ZoomPlayerOpen = shell.AppActivate("Zoom Player")
  3356.   am.clear
  3357.   ZoomPlayerMenu
  3358. End Sub
  3359.  
  3360. Sub ZoomPlayerMenu
  3361.   am.ClearMenu
  3362.   am.Title = "ZoomPlayer"
  3363.  
  3364.   If (ZoomPlayerOpen) Then
  3365.     am.AddItem "Play/Pause", "OnAMZoomPlayerPlay"
  3366.     am.AddItem "Stop", "OnAMZoomPlayerStop"
  3367.     am.AddItem "Prev Chapter", "OnAMZoomPlayerPrev"
  3368.     am.AddItem "Next Chapter", "OnAMZoomPlayerNext"
  3369.     am.AddItem "Jump ahead", "OnAMZoomPlayerJumpahead"
  3370.     am.AddItem "Jump back", "OnAMZoomPlayerJumpback"
  3371.     am.AddItem "Subtitles", "OnAMZoomPlayerSubtitle"
  3372.     am.AddItem "Volume Up", "OnAMZoomPlayerVolInc"
  3373.     am.AddItem "Volume Down", "OnAMZoomPlayerVolDec"
  3374.     am.AddItem "Mute/UnMute", "OnAMZoomPlayerVolMute"
  3375.     am.AddItem "Full Screen", "OnAMZoomPlayerFull"
  3376.     am.AddItem "Fast Forward", "OnAMZoomPlayerFastForward"
  3377.     am.AddItem "Rewind", "OnAMZoomPlayerRewind"
  3378.     am.AddItem "Close", "OnAMZoomPlayerClose"
  3379.   Else
  3380.     am.AddItem "Launch", "OnAMZoomPlayerLaunch"
  3381.   End If
  3382.   If (SettingBackOption) Then am.AddItem MenuItemBack, "onAMRoot"
  3383.  
  3384.   am.Back = "onAMRoot"
  3385.   am.Update
  3386. End Sub
  3387.  
  3388. sub OnAMZoomPlayerLaunch
  3389.   'Specify correct path to the executable here:
  3390.   shell.Run ZoomPlayerExe
  3391.   ZoomPlayerOpen = TRUE
  3392.   ZoomPlayerMenu
  3393. end sub
  3394.  
  3395. sub OnAMZoomPlayerClose
  3396.   if shell.AppActivate("Zoom Player") then shell.SendKeys "%x"
  3397.   ZoomPlayerOpen = FALSE
  3398.   ZoomPlayerMenu
  3399. end sub
  3400.  
  3401. sub OnAMZoomPlayerPlay
  3402.   if shell.AppActivate("Zoom Player") then shell.SendKeys "p"
  3403.   am.Update
  3404. end sub
  3405.  
  3406. sub OnAMZoomPlayerFastForward
  3407.   if shell.AppActivate("Zoom Player") then shell.SendKeys "%{HOME}"
  3408.   am.Update
  3409. end sub
  3410.  
  3411. sub OnAMZoomPlayerJumpback
  3412.   if shell.AppActivate("Zoom Player") then shell.SendKeys "%,"
  3413.   am.Update
  3414. end sub
  3415.  
  3416. sub OnAMZoomPlayerJumpahead
  3417.   if shell.AppActivate("Zoom Player") then shell.SendKeys "%."
  3418.   am.Update
  3419. end sub
  3420.  
  3421. sub OnAMZoomPlayerRewind
  3422.   if shell.AppActivate("Zoom Player") then shell.SendKeys "%{END}"
  3423.   am.Update
  3424. end sub
  3425.  
  3426. sub OnAMZoomPlayerStop
  3427.   if shell.AppActivate("Zoom Player") then shell.SendKeys "s"
  3428.   am.Update
  3429. end sub
  3430.  
  3431. sub OnAMZoomPlayerPrev
  3432.   if shell.AppActivate("Zoom Player")then shell.SendKeys "+["
  3433.   am.Update
  3434. end sub
  3435.  
  3436. sub OnAMZoomPlayerNext
  3437.   if shell.AppActivate("Zoom Player") then shell.SendKeys "+]"
  3438.   am.Update
  3439. end sub
  3440.  
  3441. sub OnAMZoomPlayerSubtitle
  3442.   if shell.AppActivate("Zoom Player") then shell.SendKeys "+;"
  3443.   am.Update
  3444. end sub
  3445.  
  3446. sub OnAMZoomPlayerVolInc
  3447.   if shell.AppActivate("Zoom Player") then shell.SendKeys "+{UP}"
  3448.   am.Update
  3449. end sub
  3450.  
  3451. sub OnAMZoomPlayerVolDec
  3452.   if shell.AppActivate("Zoom Player") then shell.SendKeys "+{DOWN}"
  3453.   am.Update
  3454. end sub
  3455.  
  3456. sub OnAMZoomPlayerVolMute
  3457.   if shell.AppActivate("Zoom Player") then shell.SendKeys "^m"
  3458.   am.Update
  3459. end sub
  3460.  
  3461. sub OnAMZoomPlayerFull
  3462.   if shell.AppActivate("Zoom Player") then shell.SendKeys "%{ENTER}"
  3463.   am.Update
  3464. end sub
  3465.  
  3466. '------------------------------ End ZoomPlayer ------------------------------------
  3467.  
  3468.